Each time a script is called. A log file is created with time and date + Bash Script.
Wrote a Script to kill (with all zombie process) and start asterisk where users having issue with the service could use a button on a certain webpage to restart asterisk. Am cool with it and am not having any issue with..What i would really like to do now is,.each time someone will use that button to restart the service a log should be created with time and date.
Anyone got an idea how to make this work ? |
If reading correct you allready have script that restarts asterix. Why not write the log there? Or you could use the script of asterix itselfs to do the logging.
What language is your script in? The start-stop script should be plain bash and should easily be modified. |
Quote:
Am actually using simple bash to write. Well giving more details is that i got 2 script, one to kill asterisk and another to start. U must be thinking why i got 2 script when i can do both actions in only one script. Well i tried but when i ran the script it only killed asterisk. It won't start. So what happens now is that when someone uses the button on the web page. it first calls the kill-asterisk script then start-asterisk script. And this does work! |
You could call the start asterix script a the end of the stop script.
As a reference how to do both in one script check out the scripts in /etc/init.d. They are called something like this Code:
Usege: prog_name start | stop | restart Heres a example script. Code:
function start_asterix { |
I think that should really be:
Code:
function start_asterix { --- rod. |
Besides using a dedicated logfile at this stage, it could also be generated as an entry in the system syslog facility and handled later on by syslog-ng or alike to split it again to different logfiles or forward it to a remote syslog server:
Code:
$ logger -t asterix -p daemon.info started Code:
Aug 16 23:00:59 the_hostname asterix: started |
You're totaly right Nbomer.
Nice stuff as well Reuti. |
All times are GMT -5. The time now is 04:55 PM. |