Following commands are made for reference purposes only … zaib
To add scheduled job in linux/ubuntu, use
To view installed cron
Run Script after every 5 seconds [Updated 8th Aug, 2016]
I had a UPS monitor script that should run after every 5 seconds to poll the KE input voltage / battery remaining time etc. but as we know that with CRON we can configure interval of minimum 1 minute or above, we cannot set time in seconds. so I make following workaround.
and added script as follows
# UPMON.SH is my script to monitor UPS # 10.0.0.1 is my UPS network card * * * * * /temp/upsmon.sh 10.0.0.1 * * * * * sleep 5; /temp/kemon.sh 10.0.0.1 * * * * * sleep 10; /temp/kemon.sh 10.0.0.1 * * * * * sleep 15; /temp/kemon.sh 10.0.0.1 * * * * * sleep 20; /temp/kemon.sh 10.0.0.1 * * * * * sleep 25; /temp/kemon.sh 10.0.0.1 * * * * * sleep 30; /temp/kemon.sh 10.0.0.1 * * * * * sleep 35; /temp/kemon.sh 10.0.0.1 * * * * * sleep 40; /temp/kemon.sh 10.0.0.1 * * * * * sleep 45; /temp/kemon.sh 10.0.0.1 * * * * * sleep 55; /temp/kemon.sh 10.0.0.1 * * * * * sleep 60; /temp/kemon.sh 10.0.0.1
this way the script will run and wait for five seconds before next execution. 🙂 lalalala / zaib
Run Script at Every 1st day of Month [Every Month]
Run Script on 1-am on every Monday
0 1 * * MON /temp/xdrive_noupdate.sh
Run Script Daily at 00:00 hours (midnight)
Run Script every hour
Run Script every minute
* * * * * /temp/script.sh
Run Script after every 5 minutes
*/5 * * * * /temp/script.sh
Run Script on Specific Timings And Date of Months, Example run script on 10am and 11am on 12th of every month.
00 10,11 12 * * /temp/script.sh
Run Script on Specific Hours of Every Month, Example run script on 9am of every month.
00 9 10 * * /temp/script.sh
Run Script on Specific Hours RANGES , Example run script on 10am to 8pm , means every hour from 10am-8pm
00 10-20 * * * /temp/script.sh
Shortcuts in CRON
@reboot Run once, at startup. @yearly Run once a year, "0 0 1 1 *". @annually (same as @yearly) @monthly Run once a month, "0 0 1 * *". @weekly Run once a week, "0 0 * * 0". @daily Run once a day, "0 0 * * *". @midnight (same as @daily) @hourly Run once an hour, "0 * * * *".
Scheduled CON Job running but not producing results …
[Monday 27th Feb,2017]
I scheduled few scripts on my Ubuntu 14.x box that queries remote servers for storage and send customized reports via email. I can see its execution in /var/log/syslog but the script was not able to query the remote win server.
To solve it I had to add the PATH command in the script , sample as below…
this solved the issue 🙂
These are little things that you learn on daily basis ,