- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to create Daemon?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2000 10:33 PM
09-22-2000 10:33 PM
How to create Daemon?
For Eg. If I want to create the Daemon to check the Idle terminal more than 15min. and to kill the same, is it possible Please help.
thankx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2000 11:14 PM
09-22-2000 11:14 PM
Re: How to create Daemon?
Creating a daemon is not very difficult. In attachment you find a C function that does just that.
Hope this helps,
Rik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2000 11:12 AM
09-23-2000 11:12 AM
Re: How to create Daemon?
In the simplest sense, a daemon is simply a program that performs a task. It sleeps, waiting for an event or a timer to expire, wakes up, does some work, and goes back to sleep.
Typically daemons are named with a "d" suffix, e.g. ftpd for the ftp daemon. This is very useful since many daemons run "forever" but over their elapsed time consume very litte CPU. Suffixing them with a "d" denotes this expectation.
By definition a shell script can be written to execute, for instance, a "while true do" loop; sleep; and wake up every 10 seconds or so to look for work to do. You would launch the script with the form:
# nohup impd 2>&1 /tmp/impd.log &
Depending on the nature of the the daemon you the initiation could be done in the /sbin/rc
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2000 01:48 PM
09-23-2000 01:48 PM
Re: How to create Daemon?
A more specific suggestion:
Create a shell scritp daemon as suggested in the abstract above. Since I am not near a server my syntax is from my head, but here's the idea. The output from 'who -u' gives the idle time (which is what you want) and the pid of the shell you want to kill).
Check the positions of the fields from 'who'. You may also have to fixup awk's match for the idle time, but you can get the general idea from this:
while true
do
who -u|awk '{if (split($4,A[1,:]) >= 15} {system(kill $5)}'
sleep 60
done
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2000 11:32 AM
09-24-2000 11:32 AM
Re: How to create Daemon?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2000 06:06 AM
09-25-2000 06:06 AM
Re: How to create Daemon?
Here is a syntatically correct offering of my earlier post. As written this will look for sessions idle for 15-minutes or more.
I would note too, that Tim's comments, above, are well taken. In any event, try:
# who -u|awk 'substr($6,3,2) >= 15 {system("kill -s 9 " $7)}'
...JRF...