I've wrote a php irc bot, but i need it to work in the background. With this there'd be no quits or so. What is the best way to do this?
Thanks and Regards.
You can put a task (such as command or script) in a background by appending a & at the end of the command line. The & operator puts command in the background and free up your terminal. The command which runs in background is called a job. You can type other command while background command is running.
If you started it in background use ps aux | grep time. php to get PID. Then just kill PID . If process started in foreground, use to interrupt it.
Cron jobs are timed jobs that can for example execute a PHP script. You could set up a cron job to check which user should receive his/her sms every hour. Depending on your operating system you can set up these cron jobs. For linux distrubutions there are tons of guides on how to set this up.
Take a look at the following website. There is a pretty descend explanation on how to write PHP daemons.
http://kevin.vanzonneveld.net/techblog/article/create_daemons_in_php/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With