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 06-17-2015, 11:23 AM   #1
deepGC
LQ Newbie
 
Registered: May 2015
Posts: 21

Rep: Reputation: Disabled
Crontab for specific user


Hi folks,

I have a script that needs running on reboot but not as root, but as another user.

This is the line in my crontab:

Code:
@reboot housefm /home/housefm/bootscript
However, I get this message from the server:

Code:
/bin/sh: housefm: command not found
whereas housefm is the specific user
 
Old 06-17-2015, 11:27 AM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
You don't put the username you want to use in root's crontab, you put the entire job in the user's crontab instead and leave root's crontab alone.
 
1 members found this post helpful.
Old 06-17-2015, 11:29 AM   #3
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,253

Rep: Reputation: 559Reputation: 559Reputation: 559Reputation: 559Reputation: 559Reputation: 559
if housefm is not in the default PATH try using an absolute path to the command
 
1 members found this post helpful.
Old 06-17-2015, 11:31 AM   #4
translator1111
Member
 
Registered: Jun 2010
Location: Slovakia
Distribution: Debian 8, Ubuntu 10.04 and 12.04; SLAX 6.0; ConnochaetOS 0.9.; LFS; Natty chip: VT1708S
Posts: 93
Blog Entries: 2

Rep: Reputation: 7
hello deepGC,
maybe I am wrong, but i think you are not using crontab correctly
http://unixhelp.ed.ac.uk/CGI/man-cgi?crontab+5
the command has to be after the user name
in the crontab line you need the
Quote:
Each line has five time and date
fields, followed by a user name if this is the system crontab file,
followed by a command
Faithfully,
M.
 
Old 06-17-2015, 11:34 AM   #5
deepGC
LQ Newbie
 
Registered: May 2015
Posts: 21

Original Poster
Rep: Reputation: Disabled
So, to resolve this I should log in as housefm, and edit crontab within the housefm user account? (Also delete that job from the root crontab)
 
Old 06-17-2015, 11:38 AM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Quote:
Originally Posted by deepGC View Post
So, to resolve this I should log in as housefm, and edit crontab within the housefm user account? (Also delete that job from the root crontab)
Yes
 
Old 06-17-2015, 11:38 AM   #7
deepGC
LQ Newbie
 
Registered: May 2015
Posts: 21

Original Poster
Rep: Reputation: Disabled
Give this man cookies ^
 
Old 06-17-2015, 11:39 AM   #8
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Quote:
Originally Posted by translator1111 View Post
hello deepGC,
maybe I am wrong, but i think you are not using crontab correctly
http://unixhelp.ed.ac.uk/CGI/man-cgi?crontab+5
the command has to be after the user name
in the crontab line you need the

Faithfully,
M.
Note: The "system" crontab file is NOT the same as root's personal crontab (what you get when you log in as root and run "crontab -e").
 
1 members found this post helpful.
  


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
Auto login to a specific user with specific permissions if autherization failed seismael Linux - Security 11 01-28-2014 02:04 PM
How to give read-only permission for specific user for specific folder in RedHat digitalbiopharm Linux - Newbie 15 12-28-2013 04:12 PM
[SOLVED] Crontab not executing specific script abdoullah Linux - General 3 06-17-2011 03:15 PM
How to force specific domain or user specific emails to proces in sendmail 8.13.5 FC5 peanutsa Linux - Newbie 1 03-22-2009 06:33 AM
Specific Crontab Job is not executed . Itsik Harel Linux - Server 1 03-11-2007 10:11 PM


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