LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-25-2015, 07:15 PM   #1
willc86
Member
 
Registered: Dec 2014
Posts: 56

Rep: Reputation: Disabled
best way for cron tab to work?


Hey guys ive been searching ways on backing up files from my samba server; however, since I am still new to linux, some of the terminologies are not comfortable to me, so I need someone to kindly guide me through with patience =)

anyhow

I am a little confused on where to place the command "rsync -azvh [src] [dst]

can I just type "crontab -u [user] -e" and type it in there?
or can I type it in crontab.daily and crontab.weekly

example:
cd /etc/
vim cron.daily
1 12 * * * rsync -azvh /file user@server:/filebackup

thanks a bunch guys!
 
Old 03-25-2015, 07:37 PM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
You should never edit crontab directly. Use:
Code:
crontab -e
to edit the crontab for the user currently logged in.

I can recommend to put your backup command in a script file, test it and only then place it in crontab. It is no fun to wait 12 hours and see the command failing.

Note that you cannot make any assumptions about paths and environment in cron. Use absolute path names for every command and file in your bash script.

jlinkels
 
1 members found this post helpful.
Old 03-25-2015, 09:41 PM   #3
willc86
Member
 
Registered: Dec 2014
Posts: 56

Original Poster
Rep: Reputation: Disabled
Thank you =)

I will give this a try and let you know if i receive any errors is the next days =)

btw, so what is cron.daily, cron.monthly, etc used for if it is always best to use crontab -e? does it automatically get placed in that file?
 
Old 03-26-2015, 01:55 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,903

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
see man cron, those things are explained in it.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron Tab talat Solaris / OpenSolaris 1 06-07-2007 12:04 AM
cron tab user52 Linux - Newbie 3 11-29-2006 06:53 AM
help in cron tab framedrelay Programming 1 11-15-2006 07:49 AM
cron tab, what do you use it for? Fritz_Monroe Linux - Newbie 12 09-28-2006 02:54 PM
cron tab thefedexguy SUSE / openSUSE 4 07-06-2006 11:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration