LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-24-2003, 07:36 PM   #1
ktambascio
LQ Newbie
 
Registered: Jul 2003
Location: Ohio
Distribution: Redhat 9, Fedora Test 1, Fedora Test 2, Suse 9
Posts: 13

Rep: Reputation: 0
problem with kcron


This is probably a really dumb question, but here goes. I created a backup script for a website i'm working on. The script goes like this:

----------------------------------------------------------------
#!/bin/bash

current_date=`eval date +%m-%d-%G`
default_name="_domainname_backup"
backup_dir="$current_date$default_name"

mkdir $backup_dir

scp -r user@domain.com:/home/user $backup_dir

tar -cf $backup_dir.tar $backup_dir

gzip $backup_dir.tar

mv $backup_dir.tar.gz domain.com

rm -Rf $backup_dir
-----------------------------------------------------------

when i run the script from the directory (not my home directory), everything works fine. I added the job into kcron to run daily. When i right-click on the task and choose 'run', I get output on my open terminal window that says "permission denied" for all the steps.

The permissions on the directory in which i want to create the file are 755, though even setting them to 777 didn't solve it. The task has to be running as my regular user, and my username does have permission to write to that directory.

I don't want to stick this in root's cron.daily, but I could do that.

any ideas?
-Kevin
 
Old 08-23-2003, 09:27 AM   #2
Maxmegalon
LQ Newbie
 
Registered: Aug 2003
Posts: 2

Rep: Reputation: 0
Hi,

As far as I understand how cron works, a cron job gets its own shell.
The environment variables this shell gets may not be the same as you have as a user when executing commands on a commandline. Therefore there may be differences in results.

What I do in such a case is that I either set the veriables e.g. a PATH in the script or fill in the paths to all commands I'd be using. Following the latter I would use /bin/tar in stead of plain tar.

Another thing, but you probably thought of that yourself: Your script has to be executable of course.

And ... a script run by cron may not produce any output on stderr or stdout. If it does, it will not be completed. So you need to redirect any output to a log file or /dev/null

Hope this helps.


p.s. I've just upgraded to Rh9 but I can't find kcron anymore. Do you know why it is not in the distro anymore and / or whether it is still available?
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use kcron? ginda SUSE / openSUSE 4 03-16-2005 10:18 AM
where is kcron in Mandrake 10.1? Micro420 Mandriva 0 11-12-2004 07:45 PM
Kcron Problem matux Linux - Software 0 10-07-2004 09:31 AM
weird problem with kcron .. stl1859 Linux - Software 2 09-02-2004 04:01 PM
is there no Kcron in Mandrake 10??? halo14 Mandriva 2 08-12-2004 07:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:30 PM.

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