LinuxQuestions.org
Review your favorite Linux distribution.
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 04-15-2009, 01:55 PM   #1
waynevnc
Member
 
Registered: Jun 2004
Location: New Mexico
Distribution: Debian 3.0, Pop!_OS, Manjaro
Posts: 60

Rep: Reputation: 15
Backups with Crontab & tar


I need some help with doing backups on a Ubuntu 8.04 LTS server. I have created a cron job that does not want to run. What am I doing wrong? Something simple am sure.
The crontab looks like this: 20 11 * * 4 tar -cWPpf /dev/st0 /home/public $

I know the command works cause I can run it from the command line OK but, I do have to use root. I tried using the sudo command in the crontab but, that did not work either.

Any help or suggestions would be appreciated.
Thanks
Wayne
 
Old 04-15-2009, 02:11 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Cron jobs do not run the login scripts so your usual shell environment is not available. You may have to use the full path to the commands that you want to run such as using /bin/tar instead of just tar.
 
Old 04-15-2009, 02:46 PM   #3
grepmasterd
Member
 
Registered: Aug 2003
Location: Seattle
Distribution: ubuntu, lately
Posts: 182
Blog Entries: 1

Rep: Reputation: 35
use MAILTO to view the output, to see what it may be complaining about

MAILTO=me@localhost

if it's a path issue, you can update your crontab with PATH:

PATH=/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/sbin

see `man 5 crontab` for usage of cron environment variables.
 
Old 04-16-2009, 01:49 PM   #4
waynevnc
Member
 
Registered: Jun 2004
Location: New Mexico
Distribution: Debian 3.0, Pop!_OS, Manjaro
Posts: 60

Original Poster
Rep: Reputation: 15
D'oh I figured it out.
1. I had the wrong day code Thursday and should have been Wednesday &
2. more importantly I needed to create the crontab with root (sudo) not a normal user.

Another question for grepmasterd. This server is just for file servering and not a gateway. Should I still have an email service going? Maybe just for error reports & admin reasons?

Thanks in advance
Wayne
 
Old 04-16-2009, 04:41 PM   #5
grepmasterd
Member
 
Registered: Aug 2003
Location: Seattle
Distribution: ubuntu, lately
Posts: 182
Blog Entries: 1

Rep: Reputation: 35
most distros will at least have mail configured for local delivery (ie, not over the network). Just use the 'mail' command line utility to access your local messages. see 'man mail' for details.

To test sending a message (assuming your login is 'wayne')

Code:
mail -s test -c root wayne
type some message using stdin here....
to end the message type Ctrl-D, or if your a SMTP traditionalist 
just type a period as the first and only character in the line 
like this:
.
The message should be sent to /var/mail/wayne (or wherever your system's mailboxes are). Then use 'mail' with no options to read your inbox.
 
Old 04-16-2009, 04:45 PM   #6
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
It may be simpler to add an alias redirecting mail from that server to another mail account, something like

root: myuser@myaccount.net

Ho to do this will depend on the MTA you have running.
 
Old 04-16-2009, 07:14 PM   #7
waynevnc
Member
 
Registered: Jun 2004
Location: New Mexico
Distribution: Debian 3.0, Pop!_OS, Manjaro
Posts: 60

Original Poster
Rep: Reputation: 15
I tried the command:
mail -s test -c root wayne
and got the following: the program 'mail' can be found in the following packages:
* mailx
* mailutils

I'm assuming I don't have a mail service running. What mail service would be easy to setup?
 
Old 04-16-2009, 07:31 PM   #8
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Not necessarily.

Try

ps aux | grep postfix

and

ps aux | grep sendmail

to see if either of those is running.
 
Old 04-16-2009, 07:42 PM   #9
waynevnc
Member
 
Registered: Jun 2004
Location: New Mexico
Distribution: Debian 3.0, Pop!_OS, Manjaro
Posts: 60

Original Poster
Rep: Reputation: 15
with the ps aux|grep postfix I got:
wayne 5490 0.0 0.0 3004 752 tty1 R+ 17:37 0.00 grep postfix
&
with the ps aux|grep sendmail
wayne 5493 0.0 0.0 3004 760 tty1 S+ 17:37 0.00 grep sendmail
 
Old 04-16-2009, 07:59 PM   #10
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Try ps aux | grep master

Postfix is the default mta for Ubuntu, so it probably isn't running.
 
Old 04-16-2009, 08:21 PM   #11
waynevnc
Member
 
Registered: Jun 2004
Location: New Mexico
Distribution: Debian 3.0, Pop!_OS, Manjaro
Posts: 60

Original Poster
Rep: Reputation: 15
pretty much the same output as for sendmail.

I guess I'll read up on installing and setting up postfix.
 
Old 04-16-2009, 10:43 PM   #12
grepmasterd
Member
 
Registered: Aug 2003
Location: Seattle
Distribution: ubuntu, lately
Posts: 182
Blog Entries: 1

Rep: Reputation: 35
no, don't bother with postfix or sendmail unless you want to send mail over the network. especially since there are plenty of security issues associated with email servers.

just use mailx. from the end of the mailx man page:

"Usually, Mail and mailx are just links to mail, which can be confusing."

Edit: oh and by the way, 'pidof sendmail' is the way to see if an instance of sendmail is running. don't bother piping ps output to grep.

Last edited by grepmasterd; 04-16-2009 at 10:46 PM.
 
Old 04-16-2009, 10:47 PM   #13
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Shouldn't really be any security problem with Postfix - not open relay out of the box, and he doesn't even need to allow port 25 in from outside for outgoing only.

Last edited by billymayday; 04-16-2009 at 11:50 PM. Reason: Typo
 
Old 04-16-2009, 11:16 PM   #14
grepmasterd
Member
 
Registered: Aug 2003
Location: Seattle
Distribution: ubuntu, lately
Posts: 182
Blog Entries: 1

Rep: Reputation: 35
ok, my bad. you need an mta for local delivery too (mailx does not include that). but I think exim is the default mta for debian woody. whatever is the default mta should be handling local delivery.

ah, this thread is digressing...
 
Old 04-16-2009, 11:49 PM   #15
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
It's Ubuntu 8.04 LTS btw
 
  


Reply

Tags
backup, cron, crontab, tar



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
Backups Using Tar (Question) Matey Linux - General 3 02-10-2009 06:38 AM
tar archival backups arbis Linux - Software 2 10-20-2008 09:24 PM
backups using tar and rsync cucolin@ Linux - Server 2 04-03-2007 12:25 AM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM
Incremental tar backups Pepe Linux - General 5 03-18-2002 03:31 AM

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

All times are GMT -5. The time now is 10:23 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