LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-07-2006, 06:29 AM   #1
mrgreaper
Member
 
Registered: May 2006
Posts: 167

Rep: Reputation: 15
auto running a command


hi just a quick question
i need to run a command namely
Code:
perl hlstats-awards.pl
once a day automaticly preferably in the background but i have no idea how?

im using suse 10 if that helps
 
Old 06-07-2006, 06:36 AM   #2
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,
Code:
man crontab
or put an executable under
Code:
/etc/cron.daily
regards,
slackie1000
 
Old 06-07-2006, 07:08 AM   #3
mrgreaper
Member
 
Registered: May 2006
Posts: 167

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by slackie1000
hi there,
Code:
man crontab
or put an executable under
Code:
/etc/cron.daily
regards,
slackie1000
not sure i understand first comand takes me to a manual for something called crontab the second seems more promising but its a pl file i need ran not a exe (or sh forget what executables are called in linux)
 
Old 06-07-2006, 07:11 AM   #4
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,
can you write perl but can't read a man page?
Code:
echo "perl hlstats-awards.pl" > /etc/cron.daily/nothing.sh
chmod 755 /etc/cron.daily/nothing.sh
maybe you need to give the complete PATH of hlstats-awards.pl
regards,
slackie1000
 
Old 06-07-2006, 07:49 AM   #5
mrgreaper
Member
 
Registered: May 2006
Posts: 167

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by slackie1000
hi there,
can you write perl but can't read a man page?
Code:
echo "perl hlstats-awards.pl" > /etc/cron.daily/nothing.sh
chmod 755 /etc/cron.daily/nothing.sh
maybe you need to give the complete PATH of hlstats-awards.pl
regards,
slackie1000
im unable to write perl (no experience) i have to admit this perl file is part of a counter-strike server stat page http:\\grimreaper.uk.to\tr\hlstats.php it generates the dialy awards (though its been edited to include the last seven days instead(the servers not run every day)

thank you for the help will let you know 2morro if it works lol (wont know till then i guess)

edit *updated the url gave the wrong one*

Last edited by mrgreaper; 06-07-2006 at 08:47 AM.
 
Old 06-09-2006, 09:55 AM   #6
mrgreaper
Member
 
Registered: May 2006
Posts: 167

Original Poster
Rep: Reputation: 15
nope it didnt apear to work any ideas?
 
Old 06-09-2006, 10:01 AM   #7
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,
how did you proceed? did you give the complete path of your perl script in the script? could be that you have some permission issue? trying to write something in some directory that you can't?
regards,
slackie1000
 
Old 06-10-2006, 07:28 AM   #8
mrgreaper
Member
 
Registered: May 2006
Posts: 167

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by slackie1000
hi there,
how did you proceed? did you give the complete path of your perl script in the script? could be that you have some permission issue? trying to write something in some directory that you can't?
regards,
slackie1000

followed your instructions on permissions

gave it an absolue pathe

the pl file it opens is 777 in permission

and it writes to a sql file (with root access inside the pl file)

the sh file we created has the whole path in it
 
Old 06-10-2006, 08:04 AM   #9
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,
so, the file is under /etc/cron.daily/ and every permission issue is ok.
what happens if you run the script from inside /etc/cron.daily ?
Code:
cd /etc/cron.daily/
./script_containing_your_perl_call
it runs fine?
regards,
slackie1000
 
Old 06-10-2006, 08:51 AM   #10
ghatamos
Member
 
Registered: Nov 2003
Posts: 35

Rep: Reputation: 15
should be, unless it have some requirement that it needs to be run on a specific location.
 
Old 06-10-2006, 09:56 AM   #11
ethics
Senior Member
 
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
Ignoring the schedule for now, does the command do what it is supposed to when put into a shell?
 
Old 06-11-2006, 10:05 AM   #12
mrgreaper
Member
 
Registered: May 2006
Posts: 167

Original Poster
Rep: Reputation: 15
/serv/www/htdocs/tr/perl/perl does not exist
i have changed it to perl /srv/www/htdocs/tr/perl/hlstats-awards.pl
but when i execute the command i get i get a load of errors

so i changed it to

#!/bin/sh

cd /srv/www/htdocs/tr/perl/
perl hlstats.awards.pl

that seems to work fine when issued from the command line but no idea how it will fair dially well let you guys know in a couple of days
 
Old 06-11-2006, 10:55 AM   #13
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,
if this
Code:
#!/bin/sh
cd /srv/www/htdocs/tr/perl/
perl hlstats.awards.pl
code works fine from cli you can save it under a name - ex. stats.sh - and put the file in /etc/cron.daily/ .
regards,
slackie1000
 
  


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
auto running a script from command line millionknives Slackware 7 10-03-2005 10:07 PM
Auto-running commands on X login for all users Yalla-One Linux - Software 0 09-05-2005 11:49 AM
auto application(timed by day) running krome Mandriva 1 01-31-2004 04:21 PM
auto running command.... / what have i done :| Gear_freak2000 Linux - General 13 06-12-2003 03:47 PM
Evolution Auto Running ksk Linux - General 1 03-19-2003 11:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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