Via cookbook recipe i want to add crontab entry which will help me to start application whenever my VM will restart so with entry i don't want to specify anytime i tried with this code:-
cron 'Reboot_entry' do
user node['aem_vm_cookbook']['owner']['user']
command '@reboot /bin/rm -f /ebiz/aem/crx-quickstart/conf/cq.pid ; source /etc/profile.d/aemprofile.sh > /dev/null ; /ebiz/aem/crx-quickstart/bin/start > /ebiz/aem/crx-quickstart/logs/reboot.log 2>&1'
end
For this i did not specify anytime but it is creating entry with * mark which looks like this:-
* * * * * @reboot /bin/rm -f /ebiz/aem/crx-quickstart/conf/cq.pid ; source /etc/profile.d/aemprofile.sh > /dev/null ; /ebiz/aem/crx-quickstart/bin/start > /ebiz/aem/crx-quickstart/logs/reboot.log 2>&1
This entry is working fine when VM restart but the problem it is executing every minute and if i am stopping application for some work it will start after one minute.I just want to work this reboot entry only for VM restart. If i am removing all stars this is working fine.
So i don't need any * while adding this cron entry.
The
timeproperty of the cron resource takes special times such as@reboot(:reboot). So your resource should be like: