In order to run a program at startup you have to put next line in /etc/rc.local:
test_program > /dev/null 2>&1 &
where
- test_program - is the name of the program we want to run at startup
- > /dev/null - redirects all standard output from the test_program program in /dev/null (black hole). It means all data are dropped.
- 2>&1 all standard errors are redirected in standard output. Or we could write this line as: 2>/dev/null which will redirect standart errors directly to black hole.
- & - puts our program in background.
If you want to log all data that are printed by your program do this:
test_program > log_file &
If you want to stop your program, that is running in background, type this command:
killall -9 test_program