Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   command line to cron file (https://www.warriorforum.com/programming/1308070-command-line-cron-file.html)

rhinocl 14th October 2017 01:30 PM

command line to cron file
 
I found some command line code for deleting 0 byte files from a server but I don't know what type of file extension to save it as so I can run it as a cron job?
Code:

find directory -maxdepth 1 -size 0 -delete -type F -mtime +1

Mauro Chojrin 21st October 2017 11:41 AM

RE: command line to cron file
 
If you are running it on linux it doesn't matter the extension. What does matter is the permissions.

Try saving it as "command.sh" and then run "chmod +x command.sh"

starrychloe 21st October 2017 07:28 PM

RE: command line to cron file
 
Run the command `crontab -e` to edit your cron jobs and enter that into a new line in the file like
@daily find directory...
Run `man crontab` to read the instructions on how it works. Also try superuser.com for more specific questions.

Wayne Zimmerman 31st October 2017 09:41 AM

RE: command line to cron file
 
And add blank line in the end of the file, because sometimes the command is not run if there is no blank line.


All times are GMT -6. The time now is 04:48 AM.