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.