How to read variable from file and use in cronjob | linuxtopic

Linuxtopic
0


Read variable from file and use in cronjob, Use variable from file and execute cron job using variable, variable in crontab.





Step 1 :



Create environment file


   


vi /opt/env




IP=172.17.0.1


Name=TEST-USER


Place=Indore


WEB=www.linuxtopic.com







Step 2:



Create Cronjob for every min




vi /etc/cron.d/crontab




BASH_ENV=/opt/env


SHELL=/bin/bash






* * * * * root /bin/ping -w 3 $IP > /tmp/PING.log


* * * * * root echo $Name > /tmp/name.log


* * * * * root echo $Place > /tmp/place.log


* * * * * root echo $WEB > /tmp/web.log







Step 3:



check log output :







Hindi Tutorial 







English Tutorial






Post a Comment

0Comments

Post a Comment (0)

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Ok, Go it!