LinuxQuestions.org
Help answer threads with 0 replies.
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-17-2015, 10: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, 10:27 AM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
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, 10:29 AM   #3
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
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, 10: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: 108
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, 10: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, 10:38 AM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
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, 10:38 AM   #7
deepGC
LQ Newbie
 
Registered: May 2015
Posts: 21

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

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
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



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 01:04 PM
How to give read-only permission for specific user for specific folder in RedHat digitalbiopharm Linux - Newbie 15 12-28-2013 03:12 PM
[SOLVED] Crontab not executing specific script abdoullah Linux - General 3 06-17-2011 02: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 05:33 AM
Specific Crontab Job is not executed . Itsik Harel Linux - Server 1 03-11-2007 09:11 PM

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

All times are GMT -5. The time now is 11:00 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
Open Source Consulting | Domain Registration