You are not logged in.
I want to play a music in the start service.
Edit a auto start service `play.service`.
sudo vim /etc/systemd/system/play.service
[Unit]
Wants=basic.target
After=basic.target
[Service]
User=nobody
Group=nogroup
ProtectSystem=full
ExecStart=/usr/bin/mplayer /home/welcome.mp3
ExecReload=/bin/kill -HUP $MAINPID
StandardOutput=syslog
StandardError=syslog
[Install]
WantedBy=multi-user.targetEnable it:
sudo systemctl enable play.serviceReboot,i find no music play ,so check play service:
sudo systemctl status play
● play.service
Loaded: loaded (/etc/systemd/system/play.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Mon 2022-10-17 16:51:59 HKT; 1min 27s ago
Process: 584 ExecStart=/usr/bin/mplayer /home/welcome.mp3 (code=exited, status=0/SUCCESS)
Main PID: 584 (code=exited, status=0/SUCCESS)
CPU: 151ms
Oct 17 16:51:58 debian bash[584]: Failed to initialize audio driver 'alsa'
Oct 17 16:51:58 debian bash[584]: [AO SDL] Samplerate: 48000Hz Channels: Stereo Format s16le
Oct 17 16:51:58 debian bash[584]: [AO SDL] using aalib audio driver.
Oct 17 16:51:58 debian bash[584]: [AO SDL] Unable to open audio: No available audio device
Oct 17 16:51:58 debian bash[584]: Failed to initialize audio driver 'sdl:aalib'
Oct 17 16:51:58 debian bash[584]: Could not open/initialize audio device -> no sound.
Oct 17 16:51:58 debian bash[584]: Audio: no sound
Oct 17 16:51:58 debian bash[584]: Video: no video
Oct 17 16:51:58 debian bash[584]: Exiting... (End of file)
Oct 17 16:51:59 debian systemd[1]: play.service: Succeeded.
~How can make the play service run after initializing audio driver 'alsa'?
Last edited by yufeiluo (2022-10-17 09:09:28)
Offline
basic.target is way too early. Use multi-user.target and additionally sound.target to order things in a sensible way.
And debian is not Arch? Is this an Arch system with debian as the host name for some reason??
Last edited by V1del (2022-10-17 11:52:13)
Offline