LinuxQuestions.org
Visit Jeremy's Blog.
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 05-09-2014, 03:46 PM   #1
logspalding
LQ Newbie
 
Registered: May 2014
Posts: 2

Rep: Reputation: Disabled
crontab sh issues


Simply put, crontab throws the "No such file" exception when creating a job to run a bash script @reboot. Here's what I did:

Created this script:

#!/bin/bash
clear
cd /home/admin
echo "Initializing..."
/home/admin/proc_ret.sh


Then, chmod 755 to change permissions to executable

Then, simply: crontab @reboot /home/admin/script.sh, which throws the exception.

I've also tried: crontab * * * * * @reboot... and crontab sh /home/admin/script.sh (this doesn't throw an exception, but it doesn't create a task, i.e. crontab -l shows nothing.

ANY IDEAS?
 
Old 05-09-2014, 05:07 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,679
Blog Entries: 14

Rep: Reputation: 1021Reputation: 1021Reputation: 1021Reputation: 1021Reputation: 1021Reputation: 1021Reputation: 1021Reputation: 1021
Quote:
crontab @reboot /home/admin/script.sh


To setup a crontab entry you run "crontab -e" which puts you into an edit (vi) session. You then input your detailed entry:
Code:
@reboot /home/admin/script.sh
and save then exit.

That adds the entry to the crontab file in /var/spool/cron for the user you ran the command as. (e.g. /var/spool/cron/root if you did it as the root user.)

The @reboot per "man 5 crontab" replaces the standard 5 date/time specifications so you don't add the * * * * * in addition to the @reboot.
 
Old 05-09-2014, 05:17 PM   #3
logspalding
LQ Newbie
 
Registered: May 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks

Thanks - yes, I realize now that I missed that essential step!

Thanks,

*thread closed*
 
Old 05-09-2014, 05:59 PM   #4
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,471

Rep: Reputation: 444Reputation: 444Reputation: 444Reputation: 444Reputation: 444
Personally, I would chmod 700

No reason for anyone but owner (admin?) Execute (or read ) it


Of course, root will also be able to do what it wants with said script
 
  


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
[SOLVED] Problem with crontab:: command not executed properly via crontab Ankush Seth Linux - Newbie 11 11-11-2013 07:25 AM
Crontab issues FingerprintDiVA Linux - Newbie 10 02-22-2010 01:09 AM
linux crontab vs unix crontab ytd Linux - General 2 08-09-2009 06:07 AM
Crontab issues with DD and NC Everlast Linux - Newbie 6 04-24-2006 02:02 PM
Crontab Issues mikeccs Linux - Newbie 4 11-29-2004 10:09 PM


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