LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-16-2010, 12:28 AM   #1
mech123
Member
 
Registered: Dec 2008
Posts: 36

Rep: Reputation: 16
linux crontab error(command not found)


i am scheduling a command for a specific time every day.
Linux crontab format which i am using :- MIN HOUR DOM MON DOW CMD
30 08 10 06 * /home/mach/script.sh

please tell me some presetting is required
 
Old 06-16-2010, 12:45 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello,

Does the command run from the console? Are you running the command as a normal user or as root? If as user does that user have the permissions to execute every command in the script? What's showing in your log files in regards to the command? What's the script supposed to do? Can you post the contents of your script and output of
Code:
ls -al <path/to/yourscript>
Kind regards,

Eric
 
Old 06-16-2010, 01:29 AM   #3
subho.d
Member
 
Registered: Jun 2010
Location: INDIA
Distribution: All Linux & Unix
Posts: 86

Rep: Reputation: 19
hi
Run the commend
Quote:
service crond restart
crontab -l
 
Old 06-16-2010, 01:55 AM   #4
mech123
Member
 
Registered: Dec 2008
Posts: 36

Original Poster
Rep: Reputation: 16
@EricTRA :
I am running command from console as a normal user.
command :-23 11 17 06 sed -f removeblankspace.sed demofile3

cat removeblanksapce.sed contents :
/^$/d
s/ */ /g

If i run this command(sed -f removeblankspace.sed demofile3) independently then this is executing successfully.

Output of ls -al command is :
-rw-rw-r-- 1 mach mach 16 Jun 16 11:10 remblasp.sed


@subho.d :-
service crond restart
bash: service: command not found

crontab -l :
no crontab for mach
 
Old 06-16-2010, 02:01 AM   #5
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello,

Try putting sudo in front of your command:
Code:
sudo <yourcommand>
Since you're running the command as a normal user, might be permission issue. When using sudo the system will prompt you for your user password and after typing that (doesn't echo so you're blind) should run (if your user is in the sudoers list.

Post output when you ran the command with sudo.

Kind regards,

Eric
 
Old 06-16-2010, 02:01 AM   #6
subho.d
Member
 
Registered: Jun 2010
Location: INDIA
Distribution: All Linux & Unix
Posts: 86

Rep: Reputation: 19
Ok
run
Quote:
whereis crontab
Then run the commend as per output ...
 
Old 06-16-2010, 02:03 AM   #7
subho.d
Member
 
Registered: Jun 2010
Location: INDIA
Distribution: All Linux & Unix
Posts: 86

Rep: Reputation: 19
u have the root acces ?
 
Old 06-16-2010, 02:10 AM   #8
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hi,

Just noticed something, make the script executable:
Code:
chmod +x remblasp.sed
and since the output of
Code:
crontab -l
showed that there's no crontab for your user, in which crontab did you put it, root's?

Kind regards,

Eric
 
Old 06-16-2010, 02:10 AM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
cron has a minimal default PATH setting; always provide the exact absolute path to all cmds and files used.
 
1 members found this post helpful.
Old 06-16-2010, 02:19 AM   #10
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hi,

Didn't even think of that one chrism01, thanks for pointing it out.

Kind regards,

Eric
 
Old 06-16-2010, 04:45 AM   #11
mech123
Member
 
Registered: Dec 2008
Posts: 36

Original Poster
Rep: Reputation: 16
thanks
i executed my all commands at scheduled time successfully.

But service crond restart gives me
bash: service: command not found
 
Old 06-16-2010, 05:58 AM   #12
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello,

Which Linux distro are you using? Debian, CentOS, RedHat?

Kind regards,

Eric
 
Old 06-16-2010, 06:10 AM   #13
mech123
Member
 
Registered: Dec 2008
Posts: 36

Original Poster
Rep: Reputation: 16
Rhel5
 
Old 06-16-2010, 06:23 AM   #14
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hi,

I assume you're running that restart command as normal user so can you try putting sudo in front of it?
Code:
sudo service crond restart
Kind regards,

Eric
 
  


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
Crontab 'command not found' in Fedora jax8 Linux - Server 2 01-13-2010 10:45 PM
RHEL 5.4, "crontab" command not found borfgordon Linux - Software 1 11-20-2009 12:30 PM
Unable to compile C++ programs.make:g++ command not found error.Error 127 PrathuD Programming 3 03-16-2009 01:44 PM
c++ command not found error... ? Cheka Linux - Newbie 2 01-29-2005 04:43 PM
i am getting command not found error when i am trying to perform commands in linux? sunilmuddu Linux - Newbie 7 03-24-2004 01:18 AM


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