Crontab Formatting – every 15 minutes

Crontab doesn’t remember what time you “started” (presumably the time you executed the crontab -e or crontab filename command). If you want to run the job every 15 minutes starting from an arbitrary time, you’ll have to specify that time. This: 7-59/15 * * * * command will run at 7, 22, 37, and 52 … Read more

Bash script to run php script

If you have PHP installed as a command line tool (try issuing php to the terminal and see if it works), your shebang (#!) line needs to look like this: #!/usr/bin/php Put that at the top of your script, make it executable (chmod +x myscript.php), and make a Cron job to execute that script (same … Read more

Linux shell script for database backup

After hours and hours work, I created a solution like the below. I copy paste for other people that can benefit. First create a script file and give this file executable permission. # cd /etc/cron.daily/ # touch /etc/cron.daily/dbbackup-daily.sh # chmod 755 /etc/cron.daily/dbbackup-daily.sh # vi /etc/cron.daily/dbbackup-daily.sh Then copy following lines into file with Shift+Ins #!/bin/sh now=”$(date … Read more