You need to add the COMMAND variable in the echo to display it.
cat <(fgrep -i -v "$COMMAND" <(crontab -l)) <(echo "*/3+1 * * * * $COMMAND") | crontab -
質問
There is bash script to setup a cron job .
start.sh :
read -e -p "Enter the path to the log directory: " -i "/home/arya/apps/" LOGPATH
read -e -p "Enter comma separated recepient email-ids:" EMAIL
CURRENT=`pwd`
COMMAND="python ${CURRENT}/start.sh 2014-08-01T21:12:12 2014-08-01T23:12:12 $LOGPATH $EMAIL"
echo $COMMAND #Here expected output is coming : */3+1 * * * * python /home/arya/start.sh 2014-08-01T21:12:12 2014-08-01T23:12:12 /home/arya/apps/utils anilarya280@gmail.com
cat <(fgrep -i -v "$COMMAND" <(crontab -l)) <(echo "*/3+1 * * * *") | crontab -
This is not taking $CURRENT value in crontab file. Ouput on looking file using crontab -e command:
*/3+1 * * * * rest things are missing.
Expected output :
*/3+1 * * * * python /home/arya/start.sh 2014-08-01T21:12:12 2014-08-01T23:12:12 /home/arya/apps/utils anilarya280@gmail.com
What is problem here?
PLATFORM : UBUNTU 13.04
解決
You need to add the COMMAND variable in the echo to display it.
cat <(fgrep -i -v "$COMMAND" <(crontab -l)) <(echo "*/3+1 * * * * $COMMAND") | crontab -