General discussion

Locked

Start and stop script - - UNIX /Solaris

By dan_42 ·
Can someone tell me the easiest way to automate start and stop of an event on a Unix (Solaris)?
Example: If I want application X to start at 11.00 PM and stop at 02.00 AM.

Thanks, Dan

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Start and stop script - - UNIX /Solaris

by cavedweller In reply to Start and stop script - - ...

Use the cron or at service to start a repetitive (cron) or one-time (at) scheduled program. If you can't get the program to stop on its own you can use a shell script to spawn the program, then write its PID to a temp file. Use another cron or at job to read the PID from the temp file and kill the job at the desired time. You could also tell the script to wait the required time and then kill the job.

Collapse -

Start and stop script - - UNIX /Solaris

by dan_42 In reply to Start and stop script - - ...

The question was auto-closed by TechRepublic

Collapse -

Start and stop script - - UNIX /Solaris

by ca_rlittle In reply to Start and stop script - - ...

If you want to start and stop something at a particular time on a regular basis you should use the cron facility. I suggest writing a shell script that wraps the starting and stopping of the program. This allows you to control environment variables and debugging. If you want to do this only once, then I suggest the at facility.

If you want to do this at startup/shutdown, then you should use the /etc/rc3.d directory scripts. For examples of how this works, see the /etc/rc2.d directory scripts. All script beginning with a 'S' are executed on startup. Those beginning with a 'K' are executed on shutdown.

If you want a program to always be running, and restarted if it crashes, then you can look at the /etc/inittab file.

All of these facilities can be found in the man pages.

Collapse -

Start and stop script - - UNIX /Solaris

by dan_42 In reply to Start and stop script - - ...

The question was auto-closed by TechRepublic

Collapse -

Start and stop script - - UNIX /Solaris

by ghislain.levesque In reply to Start and stop script - - ...

Hi,
just write a little script that will accept 3 parameters:
1- name of the application
2- starting time
3- ending time

the script will issue an "at" command for
param #1 at the time #2 and issue a 2nd
"at" command doing a kill -9 of the process
number at ending time specified by param #3

hope this is what you are trying to do.

Collapse -

Start and stop script - - UNIX /Solaris

by dan_42 In reply to Start and stop script - - ...

The question was auto-closed by TechRepublic

Collapse -

Start and stop script - - UNIX /Solaris

by dan_42 In reply to Start and stop script - - ...

This question was auto closed due to inactivity

Back to Linux Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums