Cael
Posts: 96
Joined: Sat Jul 07, 2012 7:08 am

running a Program at startup? (Jessie)

Sat Mar 19, 2016 1:48 am

i'm allset on my Pi2 about to use it for a web radio except for one thing "How to run pianobar on Automatic Login" i know leaving an entry in .bashrc will do if i'm manually logging in but im setting this Pi up for a "Plugin > wait for boot up > and Wifi connect and Play." deal.

i have no idea how to do it w/ systemd, any pointers?

edit: at worst if i haveto is install xorg and a WM and start pianobar thatway on startup. but im not exactly free on SD Space.. its just a spare 4GB MicroSD using RetroPie 3.6 (which uses still Jessie as a base) since the Normal SD Image in Downloads right now is a lil too big for this MicroSD (for the purpose i dont need anything fancy im not really using my Pi2 for Emulation or anything else BUT pianobar to be an Pandora Radio Player. )

User avatar
Riquez
Posts: 40
Joined: Fri Mar 11, 2016 1:53 pm
Location: Okinawa, Japan

Re: running a Program at startup? (Jessie)

Sat Mar 19, 2016 5:44 am

Not sure if this is what you are looking for ... Desktop Autostart files will run programs automatically on boot.

viewtopic.php?t=18968 in the first reply here by penguintutor.

binaryhermit
Posts: 55
Joined: Sun Apr 13, 2014 1:26 am
Location: Lockport, Illinois
Contact: Website

Re: running a Program at startup? (Jessie)

Sat Mar 19, 2016 11:50 am

If it's a command line program, using screen and the @reboot parameter in cron might do what you want.

Copied and pasted from the editor opened by "crontab -e"

Code: Select all

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
@reboot   screen -d -m -S irssi irssi
Runs irssi in a detached screen session titled irssi at boot. The "-d -m" part is necessary to start a screen session detached, the "-S irssi" sets the session name to irssi and isn't necessary.

Return to “Raspberry Pi OS”