Background service!


 
Thread Tools Search this Thread
Operating Systems HP-UX Background service!
# 1  
Old 04-03-2006
Background service!

Hi I'm wondering,
Is there a way to run an application as a background service on HP-UNIX? I'm a complete noobie! Basically I got an application that runs as an NT service on windows. This application is cross-platform and I am wondering if I could run it as some background service on HP-unix such that even if the user is logged off it still executes in the background?

Please help with information surrounding this.

Regards

James
# 2  
Old 04-03-2006
Go for daemons

If u want the program to run in background....simply give the command like :

./servname &
---------

or else you may be looking for a daemon server. Daemon is a process that is completely detached of the input terminal. There are certain programming steps to make a program to run as a daemon that are taken care while developing that code.
# 3  
Old 04-04-2006
Services on Unix are usually called daemons
because they silently and diligently run in the background for long periods
(mostly until next system reboot) and service clients (however the roles may
also be changed) thus acting like benign leprechauns contrary to malign demons
(note the different spelling).
To achieve this daemons in the traditional way fork after they have started.
This means they make an exact copy of their process also inheriting the environment
as well as file descriptors etc.
If you issue man fork you will notice that this is also the name of a Unix system library call.
Btw, you may already have come across Beastie the BSD mascot.
As can be easily realized Beastie is the incorporation of a Unix daemon with a fork in its hand.
Once a daemon has forked it would exit its parent process,
change directory to / (or into chroot), not to block other mounts,
close unused file descriptors, and do other prepatory cleanup or initialization work.
Finally to really background it would need to dissociate from any controlling terminal
by starting a new session through the setsid syscall.
In BSD style syntax you could issue ps x to get a list of all background processes.
If you started a process from an interactive shell with an appended ampersand &,
although it would background, you would still reap it if you exited your shell because on exit the shell (or the system) would send a hangup signal to all its backgrounded processes.
To avoid this you would also have to prepend a nohup before your startup command.
If you were using a Bash shell however you could still use the disown command for a merely backgrounded but not nohupped process (see man bash).
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Run one service after another service has finished - systemd

Hi all I would like to know how to run task2.service after task1.service has finished. task1.service has a timer (task1.timer), that makes it run every 5 minutes OnCalendar=*:0/5task2.service is basically a script, that has to work on the files created after task1 has finished. This is what I... (2 Replies)
Discussion started by: guilliber
2 Replies

2. AIX

Background process

how to check the process running in background? how can i run a process in background? pls explain with commands (1 Reply)
Discussion started by: udtyuvaraj
1 Replies

3. Shell Programming and Scripting

background process

Hello, This has probably been answered in other forms, however I would like to confirm this statement before I use it in production. Will this syntax work for a background process? echo "nohup server_process1 >/dir1/nohup.server_process1 2>&1 &" | ksh Please advise. Thanks (1 Reply)
Discussion started by: jerardfjay
1 Replies

4. Shell Programming and Scripting

background jobs

Hi, i have a problem with turning a job into backgrund. When i enter this at the shell: spice -b darlington.cir -r output.raw > screenout.tmp & and then let me show the currently running jobs, i get the following output: + Suspended (tty output) spice -b darlington.cir -r output.raw >... (4 Replies)
Discussion started by: qsi
4 Replies
Login or Register to Ask a Question