Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, how can i create a cronjob via the command line, every 4 hours, to pack a zip file: Code: cd /home/MyUserNameee/MyDirectory/; tar -cvzf archiv_$(date +%s).tar.gz 1* 2* 3* 4* ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2013
    Posts
    3

    cronjob/tab every 4 hours


    Hi, how can i create a cronjob via the command line, every 4 hours, to pack a zip file:
    Code:
    cd /home/MyUserNameee/MyDirectory/; tar -cvzf archiv_$(date +%s).tar.gz 1* 2* 3* 4* --remove-files
    At: 1 am, 5 am, 9 am, 13 pm, 17 pm, and 21 pm.
    How can i interrupt temporarily the cronjob?
    Thanks for your answer

  2. #2
    Linux Guru
    Join Date
    Oct 2007
    Location
    Tucson AZ
    Posts
    3,190
    You could put the commands in a bash script, make it executable and then set cron to run the script every four hours. If you want to interrupt it during the script, you can use the sleep command. sleep 60 would be 60 seconds. There are five fields in a cron job plus the command to run the script. The link below has a number of examples and there are numerous tutorials on cron jobs:

    Linux Crontab: 15 Awesome Cron Job Examples

  3. #3
    Linux Newbie
    Join Date
    Nov 2009
    Posts
    228
    serNam.

    man crontab

    Homework?

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •