Tag Info

New answers tagged

3

They work immediately after saving


0

Setting options with shopt is a shell setting. It only affects the shell instance that you run it in: it is local to the shell process and to subshells invoked by $(…), (…) and similar constructs. It has no effect on other shell scripts executed concurrently or later, nor even on independent bash scripts that happen to be executed from commands executed by ...


1

Sir I33tname gave you the answer. However you should be running separate cron job that checks for nearly full disks. This is an idea how to do that, NOT necessarily a perfect solution for your situation Use cronjob -e to add this (example change names of directories and files): 0,10,20,30,40,50 * * * * /path/to/my/script.sh 2>>/path/to/logfile script.sh ...


1

Assuming that your scripts are correct, put #!/usr/bin/php -q ..as the first line in your script (the next line will be your <?php tag), chmod the script executable, then add 0 * * * * /path/to/your/php/script.php to your crontab to run it once every hour.


0

So it turns out the problem was with environment variables that the Python script needed, and it was so early on in the script that it broke the script before it even output anything. Cron does not have a regular environment. Furthermore ssh passwords were required for pulling git repos which i was able to solve by using Keychain. Using the help of this ...


1

With ksh93 (which has a floating point $SECONDS and a builtin sleep) typeset -F SECONDS=0 typeset -i i=0 while true; do cmd sleep "$((++i - SECONDS))" done The same script will work with zsh as well but will invoke your system's sleep command. zsh has a zselect builtin, but with 1/100 resolution only.


3

You cannot run a scripts (as opposed to a binary) with SUID permission. Your script is executing, but as your user, not as root, so its iptables calls aren't working. Error messages from cron jobs go to local email. Make sure that local email is configured properly (some distributions don't do it by default). The easy solution (since you have root access) ...


1

You can use crontabs as usual on OS X, with the minor difference that the per-user files are in /usr/lib/cron/tabs/. The corontab command knows how to access them. Note that the cron daemon doesn't run by default on OS X, but launchd will start it if there are any files in /usr/lib/cron/tabs/, or if /etc/crontab exists. Speaking of launchd: as @jherran ...


2

On OS X you should use launchd. To implement it, I will explain with an example. Go to folder /Users/your-username/Library/LaunchAgents and save there the following plist file. I named it com.username.testscript.plist, but feel free to change it. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" ...


3

This following command worked for me when I tested in my machine. echo "This is the message body" | mutt -a "/path/to/file.to.attach" -s "subject of message" -- recipient@domain.com So probably the approach to follow will be something like, tar -zcf /home/blah/backup.tgz /home/blah/ echo "Please find attached the backup file" | mutt -a ...


2

From running the command in the crontab file there is no difference. At least Vixie cron (as on CentOS) checks every minute if the spool directory's modification time or that of /etc/crontab has changed. However if you edit via crontab -e, and write the crontab will be checked for glaring errors. E.g if the last line of your crontab is * * * * you will get ...


2

You should put your script in a separate directory, that for sure is available while the cron job is running, e.g. /usr/local/bin/. It is also good custom to write crontab entries like this: M H * * * test -x /usr/local/bin/myscript.sh || /usr/local/bin/myscript.sh so the crontab doesn't even try to execute the script if it is not available. You ...


0

Is java in /usr/bin directory? The crontab has a minimal PATH by default. You may have to set JAVA_HOME and PATH in your crontab: */5 * * * * JAVA_HOME=/opt/java/latest;export JAVA_HOME; \ PATH=$PATH:$JAVA_HOME/bin; \ pgrep -f exhibitor || nohup java \ -jar /pekooz/exhibitor-1.5.1/lib/exhibitor-1.5.1-jar-with-dependencies.jar \ -c file ...


2

It all depends on how you define idle. If you're thinking of idle as being no user input, then you could write a script that monitors the output of: xscreensaver-command -watch which, according to it's man page: -watch Prints a line each time the screensaver changes state: when the screen blanks, locks, unblanks, or when the running hack is changed. ...


0

step by step guide to lock folders in linux http://linux-all-over.blogspot.in/2014/10/how-to-lock-filefolder-in-linux-kali.html


1

There is no tilde expansion in your cron job, you have to put in something like: 0 */8 * * * /home/yourloginname/Documents/script.sh This will run script.sh (assuming it is executable (chmod +x script.sh)), at midnight, 8 AM and 4 PM. Leave out the first line you indicated, that would run the script every minute between midnight and 1 AM.


1

You've got it half right, but your syntax is incorrect. To run a cronjob every minute, enter asterisks in every field # m h dom mon dow command * * * * * echo "1 minute"> ~/Document/cronoutput If you look in your syslog logs you'll probably see an error along the lines of syntax error: this crontab will be ignored The syntax you're using works, ...


-1

Try out same in /tmp directory, it must work */1 * * * * echo "1 minute" > /tmp/cronoutput If you try command from commandline, it will deny you with the permission problem.



Top 50 recent answers are included