hello
could someone help me to find where is the file name where i can know the state of asterisk if it is active or not in the pc.
I need to make a c programm that reads this file (the state of asterisk) and print in the screen if it is active or not.
thanks
Write a shell script with the following command.
ps -eaf | grep asterisk
Thanks,
Suresh.
[quote=“agni_suresh896”]Write a shell script with the following command.
ps -eaf | grep asterisk
Thanks,
Suresh.[/quote]
Thank you very muck Suresh
good idea
Greetings diskonnect,
What do you mean by active status? You can guess if Asterisk server is started by locating the /var/run/asterisk.pid From there you can see what is the pid of the Asterisk. Sometimes (when Asterisk crashes) this pid file is not deleted. So if you want to ensure that Asterisk is running you can grep the ps aux for the pid. For example you can use the following script:
[code]# pid=cat /var/run/asterisk.pid
ps aux | grep -va “grep” | grep $pid[/code]
Asteriskguru Team