Gustav Karlsson
Gustav Karlsson

Reputation: 43

Running a php process on startup in Ubuntu

I'm in a school project and we use a process of collecting tweets through a stream set up with PHP. I usually run it in background through the terminal with a command like: nohup ./mystream.php 2>&1 &

This stream is supposed to be on at all times and thus I would like to make sure that this process starts up whenever the system reboots. How would I do that in Ubuntu?

Upvotes: 2

Views: 641

Answers (1)

Jay Blanchard
Jay Blanchard

Reputation: 34426

You would make it part of a script that runs doing startup. We have done this with things like Upstart which replaces the sbin/init/ daemon. Here is an example script -

start on filesystem and net-device-up IFACE=eth0
respawn

exec /usr/bin/php -f /path/to/your/process.php

Upvotes: 3

Related Questions