LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 07-23-2007, 03:19 AM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,129

Rep: Reputation: 30
Run crontab job problem


I hv a crontab job (script) that can be run normally , now I try to run it on the shell but can't be run , can advise what is difference between run a script on crontab and run it manually ? is it the difference of system enviornment ?thx

I tried to fix it by below method ,

I write a script /tmp/script1


#vi /tmp/script1
rlogn localhost -l cron_usr

#vi ~cron_usr/.profile
my_script

what I want is to make the crontab job (/tmp/script1)
will login the system and login as cron_usr .
If I run this script manually , it is OK , but if I run it by crontab job , it is not work , so I think run manully and by crontab is different , can advise how can I make it work ?

thx

Last edited by ust; 07-23-2007 at 06:33 AM.
 
Old 07-23-2007, 07:11 AM   #2
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,129

Original Poster
Rep: Reputation: 30
for simply , I just want to setup a crontab job , when run this job , it will login the system ( just like a telnet , ssh etc ) , is it possible ? thx
 
Old 07-23-2007, 03:38 PM   #3
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Rep: Reputation: 51
Code:
apt-get install kcron
then sudo gedit /etc/crontab
with
Code:
0 5 * * *       root    sh /usr/bin/myprogramorscript
 
Old 07-23-2007, 10:58 PM   #4
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,129

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by frenchn00b
Code:
apt-get install kcron
then sudo gedit /etc/crontab
with
Code:
0 5 * * *       root    sh /usr/bin/myprogramorscript
thx reply ,
I am not too clear what is this function , I have already tried it , but it pop the below message , what is wrong ? please advise.

sudo gedit /etc/crontab

(gedit:11009): Gtk-WARNING **: cannot open display:
 
Old 07-30-2007, 02:24 AM   #5
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Rep: Reputation: 51
Quote:
Originally Posted by ust
thx reply ,
I am not too clear what is this function , I have already tried it , but it pop the below message , what is wrong ? please advise.

sudo gedit /etc/crontab

(gedit:11009): Gtk-WARNING **: cannot open display:
it's certainly the X protection (it depends on the distro)
Code:
xhost + $HOSTNAME
should work (maybe, but it is not so secured. Then xhost -)

try with vim, joe, or nano (apt-get install vim nano joe) without X.

with VIM :
iiii to insert
ESC :wq to save/exit
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Run crontab job sunhui Linux - Software 2 05-16-2007 09:35 PM
crontab job and run on shell sunhui Linux - Software 1 02-13-2007 06:35 AM
how to run crontab job every 30 seconds houssamfarag Slackware 5 06-23-2006 03:45 AM
how to run crontab job every 20 seconds houssamfarag Mandriva 4 06-23-2006 03:45 AM


All times are GMT -5. The time now is 06:08 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration