Home Account

Linux init scripts with php

2011-06-18 03:45 dennis iversen

Tags: php scripts-and-functions

As seen on http://tips4linux.com/create-a-startup-script-for-debian-and-ubuntu-systems/. Edit the following file:

sudo vim /etc/init.d/local.autostart

Add this php script


// NOTE! Edit $path in the following line to a path 
$path ="/home/dennis/init_hello.log";
file_put_contents($path, "Hello World From init");


sudo chmod +x /etc/init.d/local.autostart
sudo update-rc.d local.autostart defaults 80

That is it. You got a auto start script.

Reboot and check the file /home/dennis/init.hello.log (or what ever you called the file) and look it and get you "Hello World"

This page has been requested 3968 times