run program at startup questions - Raspberry Pi Forums
hi,
wish run script @ startup, , have found following
http://www.stuffaboutcode.com/2012/06/r ... rt-up.html
know happening, new linux
- scripts have suffix .sh?
- chmod 755 'yourscript' make executable? necessary? thought run .sh
- 'registering' (update-rc.d yourscript defaults) do? list of scripts stored (assuming human readable). can list them way?
thanks,
wish run script @ startup, , have found following
http://www.stuffaboutcode.com/2012/06/r ... rt-up.html
know happening, new linux
- scripts have suffix .sh?
- chmod 755 'yourscript' make executable? necessary? thought run .sh
- 'registering' (update-rc.d yourscript defaults) do? list of scripts stored (assuming human readable). can list them way?
thanks,
- scripts have suffix .sh?
it's common, not requirement.
linux doesn't use extension (although applications / file managers may @ extension), instead uses "magic tests" examining start of file see type is.
can see kind of file have using file command eg:
more details - chmod 755 'yourscript' make executable? necessary? thought run .sh
linux uses permissions on files determine whether particular file can executed or not:
if @ excerpt above (from /etc/init.d) files have rwx (read, write , execute) owner, r-x (read , execute) group, , r-x (read , execute) else. set octal number 755.
more details see tutorial http://www.penguintutor.com/linux/file- ... -reference
can run without execute permission if use, works shell scripts.
- 'registering' (update-rc.d yourscript defaults) do? list of scripts stored (assuming human readable). can list them way?
update-rc.d creates links between /etc/init.d directory , appropriate rc.d directory.
there directory each runlevel
if in these there number of files (actually soft-links files in /etc/init.d) starting either k (kill) or s (start). whenever system changes run level runs appropriate scripts either stopping (if k) or starting (if s). number determines order run in can used run scripts before others.
example if @ runlevel 2:
more details see
it's common, not requirement.
linux doesn't use extension (although applications / file managers may @ extension), instead uses "magic tests" examining start of file see type is.
can see kind of file have using file command eg:
code: select all
$ file /etc/init.d/ntp /etc/init.d/ntp: posix shell script, ascii text executablecode: select all
man filelinux uses permissions on files determine whether particular file can executed or not:
code: select all
$ls -l /etc/init.d total 280 -rwxr-xr-x 1 root root 5195 sep 6 2011 alsa-utils -rwxr-xr-x 1 root root 1276 jul 22 2012 bootlogs -rwxr-xr-x 1 root root 1281 may 24 2012 bootmisc.sh -rwxr-xr-x 1 root root 3816 may 24 2012 checkfs.sh -rwxr-xr-x 1 root root 1099 nov 16 2012 checkroot-bootclean.sh -rwxr-xr-x 1 root root 9673 may 24 2012 checkroot.sh ..more details see tutorial http://www.penguintutor.com/linux/file- ... -reference
can run without execute permission if use
code: select all
sh scriptname- 'registering' (update-rc.d yourscript defaults) do? list of scripts stored (assuming human readable). can list them way?
update-rc.d creates links between /etc/init.d directory , appropriate rc.d directory.
there directory each runlevel
code: select all
$ ls -ld /etc/rc* drwxr-xr-x 2 root root 4096 jan 8 2013 /etc/rc0.d drwxr-xr-x 2 root root 4096 jan 8 2013 /etc/rc1.d drwxr-xr-x 2 root root 4096 jan 8 2013 /etc/rc2.d drwxr-xr-x 2 root root 4096 jan 8 2013 /etc/rc3.d drwxr-xr-x 2 root root 4096 jan 8 2013 /etc/rc4.d drwxr-xr-x 2 root root 4096 jan 8 2013 /etc/rc5.d drwxr-xr-x 2 root root 4096 jan 8 2013 /etc/rc6.d -rwxr-xr-x 1 root root 420 oct 28 2012 /etc/rc.local drwxr-xr-x 2 root root 4096 jan 8 2013 /etc/rcs.dexample if @ runlevel 2:
code: select all
$ ls -l /etc/rc2.d/ total 4 lrwxrwxrwx 1 root root 17 dec 16 2012 k01lightdm -> ../init.d/lightdm lrwxrwxrwx 1 root root 20 oct 28 2012 k05nfs-common -> ../init.d/nfs-common lrwxrwxrwx 1 root root 17 oct 28 2012 k05rpcbind -> ../init.d/rpcbind -rw-r--r-- 1 root root 677 nov 16 2012 readme lrwxrwxrwx 1 root root 18 oct 28 2012 s01bootlogs -> ../init.d/bootlogs lrwxrwxrwx 1 root root 17 oct 28 2012 s01ifplugd -> ../init.d/ifplugd lrwxrwxrwx 1 root root 14 oct 28 2012 s01motd -> ../init.d/motd lrwxrwxrwx 1 root root 17 oct 28 2012 s01rsyslog -> ../init.d/rsyslog lrwxrwxrwx 1 root root 14 oct 28 2012 s01sudo -> ../init.d/sudo lrwxrwxrwx 1 root root 24 jan 8 2013 s01tightvncserver -> ../init.d/tightvncserver lrwxrwxrwx 1 root root 22 oct 28 2012 s01triggerhappy -> ../init.d/triggerhappy lrwxrwxrwx 1 root root 14 oct 28 2012 s02cron -> ../init.d/cron lrwxrwxrwx 1 root root 14 oct 28 2012 s02dbus -> ../init.d/dbus lrwxrwxrwx 1 root root 24 oct 28 2012 s02dphys-swapfile -> ../init.d/dphys-swapfile lrwxrwxrwx 1 root root 18 dec 29 2012 s02lighttpd -> ../init.d/lighttpd lrwxrwxrwx 1 root root 15 jan 2 2013 s02mysql -> ../init.d/mysql lrwxrwxrwx 1 root root 13 oct 28 2012 s02ntp -> ../init.d/ntp lrwxrwxrwx 1 root root 16 dec 29 2012 s02squid3 -> ../init.d/squid3 lrwxrwxrwx 1 root root 13 nov 24 2012 s02ssh -> ../init.d/ssh lrwxrwxrwx 1 root root 18 oct 28 2012 s04rc.local -> ../init.d/rc.local lrwxrwxrwx 1 root root 19 oct 28 2012 s04rmnologin -> ../init.d/rmnologincode: select all
man update-rc.d
raspberrypi
Comments
Post a Comment