Sponsored Content
Top Forums Shell Programming and Scripting Finding out how long a script runs for and exit reason. Post 302279887 by daydreamer on Saturday 24th of January 2009 04:55:24 PM
Old 01-24-2009
Finding out how long a script runs for and exit reason.

I am running a daemon program that sends texts via a connected mobile phone. I run this daemon via CLI, and it loops a few commands (checking to see if there are any new texts).

It runs perfectly, the problem is, when I leave this to run on my Ubuntu Desktop, and come back to it hours later it has stopped running.

I need to find out why it exited, and when, so I can write a cron task to start it up periodically. - how do i do this best?

Thanks.
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Finding out how long a command takes to run

Hi I am trying to find out the best way to find out how long a command takes to run in miliseconds .. Is there such a way of doing this in Unix ? Thanks (3 Replies)
Discussion started by: cfoxwell
3 Replies

2. Solaris

finding boot reason in solaris

hi, how do i find boot reason in solaris? i know that signal 15 reboot is a manual reboot... #cat /var/adm/messages | grep -i signal what does this mean from #last -10 "reboot system boot Sun Oct 19 09:24" is it a system boot (auto reboot by the server) or human... (5 Replies)
Discussion started by: cromohawk
5 Replies

3. Shell Programming and Scripting

How would you return how long a script runs for?

When running a ksh script, how would you time how long it took the script ran for? Is there a command that can capture this? (1 Reply)
Discussion started by: Jazmania
1 Replies

4. UNIX for Dummies Questions & Answers

finding string in very long file without newlines

What's the best way to find a string in a very long file without newlines in Unix? The standard utility I'm aware of for finding a string in a single file is grep, but for a long file without newlines, I think the output is just going to be the input. I suppose I could use sed to replace the... (5 Replies)
Discussion started by: aaronpoley
5 Replies

5. Shell Programming and Scripting

How long screen command runs?

Does screen command run forever? Suppose I have following command inserted at my putty shell followed by screen # screen # export JAVA_HOME=/usr/java/jdk1.6.0_21 # export ANT_HOME=/usr/ant # export PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin # export... (0 Replies)
Discussion started by: ninadgac
0 Replies

6. Shell Programming and Scripting

Quick question about finding the PID of long-running processes

The end result that I'd like is to terminate any process on my ps -u username list that extends beyond 20 minutes. I know for a fact that this process will be named l.exe, but I don't know the number in between and I won't know the PID. Is there a way to use grep or pidof to do this task every 20... (2 Replies)
Discussion started by: Bolanok
2 Replies

7. Shell Programming and Scripting

Help with finding the exit status of a 'nohup' command using 'PID'.

Hello All, I need to run a set of scripts, say 50 of them, parallely. I'm running these 50 scripts, from inside a script with the help of 'nohup' command. 1.The fifty scripts are stored in a separate file. 2.In a master script, i'm reading every line of the file through loop and executing... (4 Replies)
Discussion started by: SriRamKrish
4 Replies

8. UNIX for Beginners Questions & Answers

Finding largest files takes too long

Good evening. because the folder has thousand of files it takes too long and have some trouble to get the largest files and then compress files or delete it, for instance find . -size +10000000c -exec ls -ld {} \; |sort -k5n | grep -v .gz The above commad took an hour and i have to cancel... (10 Replies)
Discussion started by: alexcol
10 Replies
DAEMON(8)						    BSD System Manager's Manual 						 DAEMON(8)

NAME
daemon -- run detached from the controlling terminal SYNOPSIS
daemon [-cfr] [-p child_pidfile] [-P supervisor_pidfile] [-u user] command arguments ... DESCRIPTION
The daemon utility detaches itself from the controlling terminal and executes the program specified by its arguments. Privileges may be low- ered to the specified user. The options are as follows: -c Change the current working directory to the root (``/''). -f Redirect standard input, standard output and standard error to /dev/null. -p child_pidfile Write the ID of the created process into the child_pidfile using the pidfile(3) functionality. The program is executed in a spawned child process while the daemon waits until it terminates to keep the child_pidfile locked and removes it after the process exits. The child_pidfile owner is the user who runs the daemon regardless of whether the -u option is used or not. -P supervisor_pidfile Write the ID of the daemon process into the supervisor_pidfile using the pidfile(3) functionality. The program is executed in a spawned child process while the daemon waits until it terminates to keep the supervisor_pidfile locked and removes it after the process exits. The supervisor_pidfile owner is the user who runs the daemon regardless of whether the -u option is used or not. -r Supervise and restart the program if it has been terminated. -u user Login name of the user to execute the program under. Requires adequate superuser privileges. If the -p, -P or -r option is specified the program is executed in a spawned child process. The daemon waits until it terminates to keep the pid file(s) locked and removes them after the process exits or restarts the program. In this case if the monitoring daemon receives software termination signal (SIGTERM) it forwards it to the spawned process. Normally it will cause the child to exit, remove the pidfile(s) and then terminate. The -P option is useful combined with the -r option as supervisor_pidfile contains the ID of the supervisor not the child. This is especially important if you use -r in an rc script as the -p option will give you the child's ID to signal when you attempt to stop the service, causing daemon to restart the child. EXIT STATUS
The daemon utility exits 1 if an error is returned by the daemon(3) library routine, 2 if child_pidfile or supervisor_pidfile is requested, but cannot be opened, 3 if process is already running (pidfile exists and is locked), otherwise 0. DIAGNOSTICS
If the command cannot be executed, an error message is displayed on standard error unless the -f flag is specified. SEE ALSO
setregid(2), setreuid(2), daemon(3), exec(3), pidfile(3), termios(4), tty(4) HISTORY
The daemon utility first appeared in FreeBSD 4.7. BSD
September 13, 2013 BSD
All times are GMT -4. The time now is 01:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy