crontab job for running every minute | overwrite file

 

1. create a bash script in linux :

vi /data/1

*************************

#!/bin/bash

mkdir /data

echo "test file for ">orig

for i in {000..010}

do

 yes| cp orig file$i

done

*************************

2.provide executable permisions
chmod +x /data/1

3.Add to cron:
run: "crontab -e " and enter below content:

* * * * * (cd /data && /bin/bash /data/1)

and save the file

4.verify the cron entries
crontab -l


5.restart the crond service:
systemctl restart crond

verify the scrip run everyminute.


No comments:

Post a Comment

How to increase ESXi webclient login user application timeout

 To increase the default 15min timeout to 2hr Login to the esxi webclient on the right top corner ->Click the User login tab Select "...