Register Advertise with usHelp Desk Today's Posts Search

Thread Tools Search this Thread
Unread 14th Oct 2017, 01:30 PM   #1
Senior Warrior Member
War Room Member
 
Join Date: 2009
Posts: 1,057
Thanks: 124
Thanked 198 Times in 147 Posts
Default
command line to cron file
Share on: 
fb share twitter share gplus share more share

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

rhinocl is offline   Reply With Quote
Unread 21st Oct 2017, 11:41 AM   #2
Warrior Member
 
Mauro Chojrin's Avatar
 
Join Date: 2017
Location: Buenos Aires, Argentina
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default
RE: command line to cron file
Share on: 
fb share twitter share gplus share more share

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"
Mauro Chojrin is offline   Reply With Quote
Unread 21st Oct 2017, 07:28 PM   #3
Warrior Member
 
Join Date: 2014
Posts: 28
Thanks: 41
Thanked 9 Times in 7 Posts
Default
RE: command line to cron file
Share on: 
fb share twitter share gplus share more share

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.
starrychloe is offline   Reply With Quote
Unread 31st Oct 2017, 09:41 AM   #4
Warrior Member
 
Wayne Zimmerman's Avatar
 
Join Date: 2017
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Default
RE: command line to cron file
Share on: 
fb share twitter share gplus share more share

And add blank line in the end of the file, because sometimes the command is not run if there is no blank line.
Wayne Zimmerman is offline   Reply With Quote


Bookmarks

Tags
command, cron, file, line


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




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