Tag Info

Hot answers tagged

28

From crontab(5): The ``sixth'' field (the rest of the line) specifies the command to be run. The entire command portion of the line, up to a newline or % character, will be executed by /bin/sh or by the shell specified in the SHELL variable of the crontab file. Percent-signs (%) in the command, unless escaped with backslash (), will ...


11

For anyone trying to understand what usage output means, the best way is to man man. seriously :-) Take the time to learn the conventions, it really helps. The following conventions apply to the SYNOPSIS section and can be used as a guide in other sections. bold text type exactly as shown. italic text replace with appropriate ...


11

Powershell primarily uses new lines as statement seperators, but semicolons may be used for multiple statements on a single line.


7

In BIND's zone file as well as in named.conf, IN is a class. You can omit it in any of the files or in both, in any case if class is not explicitly specified, the default "IN" is used. Regarding the meaning of "IN" - RFC 1035 section 3.2.4: The following CLASS mnemonics and values are defined: IN 1 the Internet ...


5

You are missing a semicolon (and I'm not sure if it works without square brackets). Alternatives: if [[ $? -ne 0 ]];then or if ! test $? = 0; then or if [ $? -ne 0 ];then or test $? = 0 || echo 'error'; or even better: rm /bla/bla || echo 'error'; (the last one is your whole script)


5

The key, no matter whether you choose to use semicolons or not, is to be consistent. If you are used to using them in C#, then continue to use them in PowerShell. If you don't want to use them, then don't use them. Pick a standard and stick with it for you and the people that will read and use your code. It will get ugly if you decide halfway through a ...


4

man ssh man sshd man ssh_config man sshd_config http://www.ietf.org/rfc/rfc4251.txt should tell you everything you need to know.


4

sudo -u user command will run command as user without the need to invoke su. You will need to set it up in your sudoers file first. Also, you could put the command you want to run in a small script and sidestep the quoting problems.


3

range is a reserved word in 5.1 http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html So if you use it, you need to use the back ticks in order to tell mysql that you aren't using the reserved word. range wasn't in 5.0


3

Always thought it means Internet Number. According to Wikipedia is actually just Internet: The CLASS of a record is set to IN (for Internet) for common DNS records involving Internet hostnames, servers, or IP addresses.


3

You seem to miss the most important line: auto xenbr0 iface xenbr0 inet static bridge_ports eth0 eth4 eth7 # bridge traffic between these interfaces bridge_stp no address 10.0.0.1 netmask 255.255.255.0 network 10.0.0.0 broadcast 10.0.0.255 man says: If you need to specify the interfaces more flexibly, you can use the following syntax ...


3

I had a lot of problems with backticks also. Sometimes you need more than one occurrence of quotes and backticks. Just replace them for $(). Example: export NOW=`date` by export NOW=$(date) -Gilson Soares


3

The suggested way to execute local commands remotely via ssh is not to use eval. This is discouraged. Since you are storing the whole line in a variable, instead you could mydate=$(date; date; date); ssh rsync@example.org bash <<< "$(printf 'echo %q ' "$mydate")" Eval should only be used in legacy systems who do not provide safe tools like the ...


2

First of all, while there are general conventions, they are not uniformly applied. In this case, it's saying that if you use -R (indicating "recursion"), then you can use either -H, -L, or -P. If you don't use -R, then those options are not relevant. Yes, case is almost always important. So usually -h and -H do completely different things. The square ...


2

[Answering own question after getting around to prodding at the config for a while] I've managed to track this down to one of the modules which I have written (of course), but it was due to a use of a variable which didn't work out how I expected. What happened was: $variable_dir = "/etc/puppet/bar" class foo { file { $variable_dir: ensure => ...


2

Here's a very handy alternative. The "test" command is itself a command like "rm". It sends a return code to "if": 0 if it succeeds and 1 or greater if it fails. So instead of checking the return code in the special $? variable, you can just do this: if rm foo; then echo "It worked" else echo "It failed" fi You can also negate the if by doing ...


2

Are you sure? Maybe there are is a symlink and the destination path actually is a subfolder of the source path. Compare the output of readlink -e /home/admin/Downloads/folder1 and readlink -e /home/admin/MyLibrary/MyVideos/TV/folder1.


2

Those are conditional loads. If a specific Apache module is loaded, then allow that configuration block to take effect. If the modules are not loaded, they're not executed.


2

"require" does not do what you think it does -- it actually creates a dependency. You want to use "include" instead in class capistranoDeps::config include capistranoDeps::user For more information, also see this question: What's the difference between include and require in puppet


2

Use back ticks (`) around column name password (password is a reserved work in MySQL) if you are not using. Don't use LAST_INSERT_ID() in the first query as you have not added any record to this table yet. The queries will be INSERT INTO jos_users (`name`, `username`, `password`, `params`) VALUES ('Administrator2', 'admin2', ...


2

Puppet 0.25 does not support parametrized classes, you must upgrade to puppet > 2.6.


2

You're missing a closing quote on the SSYdrybulk? term. The >> is there to show that it's waiting for a closing character of some kind, like a quote or a paren.


2

The elaborate precautions against $TRUE being empty are not needed if double quotes are used. [ "$TRUE" = 'true' ] The -z tests if $TRUE is not empty, and :- substitutes nothing if it is unset. It is all unnecessary. Perhaps it is a protest against an over-prescriptive coding standard.


2

As @drew-khoury and @ramruma point out, the [ -z ... test is superfluous. Using TRUE as the name of a variable just adds to the confusion. The actual question that snippet tries to answer is: did twiddle.sh print Started=true? Or, in shell speak: jboss_is_started() { ($JBOSS_TWIDDLE get jboss.system:type=Server Started | grep 'Started=true' | ...


2

Try shell/bash build-in eval command: $ help eval eval: eval [arg ...] Execute arguments as a shell command. Combine ARGs into a single string, use the result as input to the shell, and execute the resulting commands. Exit Status: Returns exit status of command or success if command is null.


2

There is no reason to compose such a long string of commands to run via SSH. Just make a permanent script on the remote host called /usr/local/sbin/rotate_backups and call it with ssh $USER@$HOST 'sudo /usr/local/sbin/rotate_backups'. If you were asking this on the "Unix & Linux" StackExchange, then this could be an interesting question. However, as ...


2

Try this: user@server:~$ remote_cmd=(ssh rsync@otherserver.example.org 'date; hostname -A; uname -a') user@server:~$ "${remote_cmd[@]}" It creates an array and executes it as suggested in BashFAQ/050 item 3.


2

EDIT Just a quick note to say, one way to avoid having your Apache server hosed if the config file chokes due to a change is to first reload Apache to see how it parses the config. sudo service apache2 reload The nice thing about reload is it will attempt to reload the settings in a config file, but it won’t force the server to stop or restart. If it ...


2

Try: update Table1 t1 set t1.Firstname = 'Temp1' inner join Table2 t2 on t1.Id = t2.Id -- Whatever your PK and FK are here where t1.Firstame = 'xxx' and t2.CreateTS < '2014-02-08 15:00:00.000'


2

Here below you have the answer. To highlight the change, I inserted two FirstName as 'not_updated'. Please, see SQL_Fiddle update Table1 join Table2 on Table1.id = Table2.id set Table1.FirstName = 'Temp1' where Table2.CreateTS < '2014-02-08 15:00:00.000'; I hope this helps.



Only top voted, non community-wiki answers of a minimum length are eligible