LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 02:19 AM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 31
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 05:33 AM.
 
Old 07-23-2007, 06:11 AM   #2
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
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, 02:38 PM   #3
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

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

Original Poster
Rep: Reputation: 31
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, 01:24 AM   #5
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Rep: Reputation: 57
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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