bash - Automatic triggering of a job -
i want batch script check in share drive file(file name partially fixed) , if file exists, trigger mail , trigger sql job.
create simple script tests file , takes desired actions, install crontab crontab -e
run @ frequency like. example:
#!/bin/bash if test -e "/path/to/filename"; echo "hey, file want: filename -- exists." | \ mail -s "file: filename exists" you@yourhost.com mysql -uuser -hhost -nb -e "your sql command here" fi
name filetest.sh
, make executable chmod 0755 filetest.sh
. install crontab crontab -e
. set run whenever every 10 minutes:
0,10,20,30,40,50 * * * * /path/to/filetest.sh
save , pretty done.
Comments
Post a Comment