Visit Our UNIX and Linux User Community

Start program in background (or start crontab ahead of time)

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Start program in background (or start crontab ahead of time)
# 1  
Old 07-21-2009
Start program in background (or start crontab ahead of time)


I'm working on a script that will add a user, create some configfiles, and add a crontab for the user.

The crontab looks like the following:
@reboot /home/user/program config.conf &

I would like for this process to start at the end of my script under the corresponding username by either running the crontab ahead of time, or by making sure that the program is started as if the user was running it himself.

How do I do that?

The script already does what i want, except for running the program.

---------- Post updated at 12:06 PM ---------- Previous update was at 11:52 AM ----------

Never mind.. sudo was the answer.. Smilie

Previous Thread | Next Thread
Test Your Knowledge in Computers #107
Difficulty: Easy
Each Unix kernel subsystem has key features like concurrency, virtual memory, paging, and a virtual file system.
True or False?

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to start jobs manually from Crontab

Hello - I have about 7 jobs listed in my crontab. They run automatically everyday. However I am wondering how to start them manually? My system is SunOS 5.10 Jobs are listed in this fashion: 41 00 * * 1-5 /system/volms/.vbc/startmeup 01 44 * * 0-6 /system/volms/.vbc/kill (space)... (7 Replies)
Discussion started by: DallasT
7 Replies

2. Shell Programming and Scripting

How to calculate time difference between start and end time of a process!

Hello All, I have a problem calculating the time difference between start and end timings...! the timings are given by 24hr format.. Start Date : 08/05/10 12:55 End Date : 08/09/10 06:50 above values are in mm/dd/yy hh:mm format. Now the thing is, 7th(08/07/10) and... (16 Replies)
Discussion started by: smarty86
16 Replies

3. Homework & Coursework Questions

little start c program

hello, i wil make the next mission: give how many chambers in a constant number. use an array which chamber is free and count how many chamber there are free. make also something to test I don't now how to start. I need an little example so i can make the mission thank you (10 Replies)
Discussion started by: wouter88
10 Replies

4. Linux

Process start time not showing correct time

Process start time is not showing the correct time: I had started a process on Jun 17th at 23:30:00. Next day morning when I run the command "ps -ef | grep mq", the process is showing the start date of Jun 17th but the start time is 00:16:41 Day/Date is setup correctly on the server. It... (2 Replies)
Discussion started by: hemangjani
2 Replies

5. Programming

How to start a process in linux using C program??

I have a set of attributes such as group id,group name,etc related to a linux process. Iwant to know how to start a process in linux using C program.Plz do help me. (3 Replies)
Discussion started by: vigneshinbox
3 Replies

6. Shell Programming and Scripting

Start and End times of background processes

Hi I'm running 4 jobs in the background and I need to write the start and end times to a log file. I know there's probably a simple way to do this but, I can't think of it. I've used nohup <script name> & but, that doesn't record the times. Is there a way to get the start and end times of a... (2 Replies)
Discussion started by: stonemonolith
2 Replies

7. Shell Programming and Scripting

start a program with other user's permission

I have some of programs in unix system which are to started with one_user say "xxxx". I have sudo permission if i start these programs with sudo it shows root permission. But i want these programs permession should be "xxxx". I tried "su user_name -c Program_name" but it is not... (3 Replies)
Discussion started by: srikanthus2002
3 Replies

8. Shell Programming and Scripting

Start time/end time and status of crontab job

Is there anyway to get the start time and end time / status of a crontab job which was just completed? Of course, we know the start time of the crontab job since we are scheduling. But I would like to know process start and time recorded somewhere or can be fetched from a command like 'ps'. ... (3 Replies)
Discussion started by: thambi
3 Replies

9. UNIX for Dummies Questions & Answers

How do I start a program when I start my Computer?

I'm running MAC OS X and I'm wondering how I start 'nixey programs (not normal apps) on startup? Things like the dnet client and hxd Hotline Server. Anyone know? (1 Reply)
Discussion started by: l008com
1 Replies
CRONTAB(1)						    BSD General Commands Manual 						CRONTAB(1)

crontab -- maintain crontab files for individual users (ISC Cron V4.1) SYNOPSIS
crontab [-u user] crontab [-elr] DESCRIPTION
crontab is the program used to install, deinstall, or list the tables used to drive the cron(8) daemon in ISC Cron. Each user can have their own crontab, and though these are files in /var/cron, they are not intended to be edited directly. If the /var/cron/allow file exists, then you must be listed therein in order to be allowed to use this command. If the /var/cron/allow file does not exist but the /var/cron/deny file does exist, then you must not be listed in the /var/cron/deny file in order to use this command. If neither of these files exists, depending on the compiled in settings, only the super user will be allowed to use this command, or everyone will be allowed to use this command. On NetBSD everyone is allowed to use this command. The default maximum size for a crontab is 256 kilobytes, but this may be changed for all users on the system by putting the desired maximum size (in bytes) in the /var/cron/maxtabsize file. If the -u option is given, it specifies the name of the user whose crontab is to be tweaked. If this option is not given, crontab examines ``your'' crontab, i.e., the crontab of the person executing the command. Note that su(1) can confuse crontab and that if you are running inside of su(1) you should always use the -u option for safety's sake. The first form of this command is used to install a new crontab from some named file or standard input if the pseudo-filename ``-'' is given. The -l option causes the current crontab to be displayed on standard output. The -r option causes the current crontab to be removed. The -e option is used to edit the current crontab using the editor specified by the VISUAL or EDITOR environment variables. After you exit from the editor, the modified crontab will be installed automatically. FILES
/var/cron/allow Optional list of users that are allowed to use crontab. /var/cron/deny Optional list of users that are disallowed to use crontab. /var/cron/maxtabsize Maximum size of crontab files. Defaults to 256 kilobytes. /var/cron/tabs/ Directory containing the individual user crontab files, named after the user. DIAGNOSTICS
A fairly informative usage message appears if you run it with a bad command line. SEE ALSO
crontab(5), cron(8) STANDARDS
The crontab command conforms to IEEE Std 1003.2 (``POSIX.2''). This new command syntax differs from previous versions of Vixie Cron, as well as from the classic Version 3 AT&T UNIX syntax. AUTHORS
Paul Vixie <> BSD
May 6, 2010 BSD

Featured Tech Videos