-
cloudsuser
-
cron job execution...
-
$crontab -e
* * * * * /root/cronJob.sh >> /root/cronJobExecuted.log
[u][b]Source: cronJob.sh[/b][/u]
sh /root/scheduledJob.sh
[u][b]Source: scheduledJob.sh[/b][/u]
One of my web application will keep on insert list of ssh command in my file "scheduledJob.sh" such as
ssh -i key.pem root@ -C sh /mnt/monitor.sh >> /root/Output.txt
ssh -i key.pem root@ -C sh /mnt/monitor.sh >> /root/Output.txt
In remote machine,
[u][b]Source: monitor.sh[/b][/u]
echo `cat /mnt/imageOutput.txt`
[u][b]Source: imageOutput.txt[/b][/u]
line1
line2
As soon as when ssh get executed in scheduledJob.sh, I should not execute it again.
How is should handle this...
[u]
[b]Example:[/b][/u]
Cronjob has executed 1) ssh -i key.pem root@ -C sh /mnt/monitor.sh >> /root/Output.txt
and 2)ssh -i key.pem root@ -C sh /mnt/monitor.sh >> /root/Output.txt
Again when cronjob trying to execute, it should skip the above 2 ssh command , it should execute only the new command if and only if exist....How i can handle this ?
-
03 Jun 10
$crontab -e
* * * * * /root/cronJob.sh >> /root/cronJobExecuted.log
Source: cronJob.sh
sh /root/scheduledJob.sh
Source: scheduledJob.sh
One of my web application will keep on insert list of ssh command in my file "scheduledJob.sh" such as
ssh -i key.pem root@<host1> -C sh /mnt/monitor.sh >> /root/Output.txt
ssh -i key.pem root@<host2> -C sh /mnt/monitor.sh >> /root/Output.txt
In remote machine,
Source: monitor.sh
echo `cat /mnt/imageOutput.txt`
Source: imageOutput.txt
line1
line2
As soon as when ssh get executed in scheduledJob.sh, I should not execute it again.
How is should handle this...
Example:
Cronjob has executed 1) ssh -i key.pem root@<host1> -C sh /mnt/monitor.sh >> /root/Output.txt
and 2)ssh -i key.pem root@<host2> -C sh /mnt/monitor.sh >> /root/Output.txt
Again when cronjob trying to execute, it should skip the above 2 ssh command , it should execute only the new command if and only if exist....How i can handle this ?