I have a folder where some files are written upon an event. I have a bash job that monitors the folder, upon recieving new file, it triggers a job to start.
here is what i am doing currently in crontab
@reboot /home/user/start_bash.sh
and in bash
#!/bin/bash
### Set initial time of file
LTIME=`stat -c %Z /home/client/data/*.txt`
while true
do
ATIME=`stat -c %Z /home/client/data/*.txt`
if [[ "$ATIME" != "$LTIME" ]]
then
Rscript /home/user/scripts/start_script.R
echo "Fertig."
LTIME=$ATIME
fi
sleep 5
done
now there is a requirement that we should update and restart the system every first sunday of the month at 2am.
EDIT: I would like to not to start the job from 01:55 and start the job at 2:30 AM every first Sunday of the month.
How can i achive this?
Thanks in advance.
55 01 1-7 * 7 /usr/bin/killall /home/user/start_bash.sh
Run a script to kill the running process at 01:55 in the first 7 days of every month where the day of the month is Sunday
30 02 1-7 * 7 /home/user/start_bash.sh
Restart the script at 02:30 in the first 7 days of every month where the day of the month is Sunday