Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 05-09-2014, 03:46 PM   #1
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:

cd /home/admin
echo "Initializing..."

Then, chmod 755 to change permissions to executable

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

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

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

Rep: Reputation: 1214Reputation: 1214Reputation: 1214Reputation: 1214Reputation: 1214Reputation: 1214Reputation: 1214Reputation: 1214Reputation: 1214
crontab @reboot /home/admin/

To setup a crontab entry you run "crontab -e" which puts you into an edit (vi) session. You then input your detailed entry:
@reboot /home/admin/
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
LQ Newbie
Registered: May 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled

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


*thread closed*
Old 05-09-2014, 05:59 PM   #4
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


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 > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:17 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration