If you want to run it only once, you can use the at command : https://en.wikipedia.org/wiki/At_(command)
Example :
echo "echo \"this is a test program\" >> /tmp/xyz.log" | at 1127 apr 11
If you want to run it every day, you might need to use a loop :
#!/bin/bash
while true;
do
DATE=`date | cut -d' ' -f4`
echo $DATE
if [[ $DATE == "11:33:00" ]]
then
echo "this is a test program" >> xyz.log
sleep 1s
fi
done
manpreet
Best Answer
2 years ago
I want to run a script without using cron at specific time. But it is not working.