You are not logged in.
Pages: 1
I installed plex media server and got it to work . How can I get it to start while booting up? To start the program I go to /usr/lib/plexmediaserver/start.sh and click on start.sh.
Offline
There are many ways to do this, and even more wiki pages and forum discussions addressing this type of question.
Have you searched for them? Have you read them? Have you tried them?
You should.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Ladies and Gents, allow me to introduce Google:
First page search results:
https://wiki.archlinux.org/index.php/Autostarting
https://bbs.archlinux.org/viewtopic.php?id=154251
Offline
Yes i searched and nothing works. The only way I can get it to start is to click on start.sh in a file manager. I even tried a short cut on the desktop and that does not work either. I also tried systemctl (https://bbs.archlinux.org/viewtopic.php?id=154251) did not work.
Offline
"did not work" is not useful information.
*What* exactly did you try, and what was the outcome/error messages.
What file manager are you using, and what does your file manager do when you click on that start.sh?
What is in start.sh?
What happens when you run start.sh from a terminal?
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Assuming you installed it using the AUR package, it comes with a systemd service file. If that is not working, check your journal for clues, and if necessary report it to the maintainer.
<edit>I've just built and installed this myself, and it works fine here - run
systemctl start plexmediaserver
to start it, then
systemctl status plexmediaserver
for details.
Last edited by tomk (2013-03-07 15:16:42)
Offline
Here is the output systemctl start and status
[root@greg greg]# systemctl start plexmediaserver
Job for plexmediaserver.service failed. See 'systemctl status plexmediaserver.service' and 'journalctl -xn' for details.
[root@greg greg]# systemctl status plexmediaserver
plexmediaserver.service - Plex Media Server for Linux
Loaded: loaded (/usr/lib/systemd/system/plexmediaserver.service; enabled)
Active: failed (Result: exit-code) since Thu 2013-03-07 16:11:45 EST; 30s ago
Process: 10101 ExecStartPre=/bin/sh -c /usr/bin/test -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" || /bin/mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" (code=exited, status=217/USER)
Mar 07 16:11:45 greg systemd[1]: Starting Plex Media Server for Linux...
Mar 07 16:11:45 greg systemd[1]: plexmediaserver.service: control process e...17
Mar 07 16:11:45 greg systemd[1]: Failed to start Plex Media Server for Linux.
Mar 07 16:11:45 greg systemd[1]: Unit plexmediaserver.service entered faile...te
[root@greg greg]# journalctl -xn
-- Logs begin at Tue 2013-03-05 13:05:35 EST, end at Thu 2013-03-07 16:11:45 EST. --
Mar 07 15:59:30 greg dbus[277]: [system] Activating via systemd: service name='org.freedesktop
Mar 07 15:59:30 greg dbus-daemon[277]: dbus[277]: [system] Activation via systemd failed for u
Mar 07 15:59:30 greg dbus[277]: [system] Activation via systemd failed for unit 'dbus-org.free
Mar 07 16:11:39 greg su[10097]: (to root) greg on /dev/pts/2
Mar 07 16:11:39 greg su[10097]: pam_unix(su:session): session opened for user root by greg(uid
Mar 07 16:11:45 greg systemd[1]: Starting Plex Media Server for Linux...
-- Subject: Unit plexmediaserver.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/li … temd-devel
-- Documentation: http://www.freedesktop.org/wiki/Softwar … 2da4a758f6
--
-- Unit plexmediaserver.service has begun starting up.
Mar 07 16:11:45 greg systemd[10101]: Failed at step USER spawning /bin/sh: No such process
-- Subject: Process /bin/sh could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/li … temd-devel
-- Documentation: http://www.freedesktop.org/wiki/Softwar … c1b4ec9a86
--
-- The process /bin/sh could not be executed and failed.
--
-- The error number returned while executing this process is 3.
Mar 07 16:11:45 greg systemd[1]: plexmediaserver.service: control process exited, code=exited
Mar 07 16:11:45 greg systemd[1]: Failed to start Plex Media Server for Linux.
-- Subject: Unit plexmediaserver.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/li … temd-devel
-- Documentation: http://www.freedesktop.org/wiki/Softwar … 5d2428ba40
--
-- Unit plexmediaserver.service has failed.
--
-- The result is failed.
Mar 07 16:11:45 greg systemd[1]: Unit plexmediaserver.service entered failed state
(END)
Here is the status of journalctl
-- Logs begin at Tue 2013-03-05 13:05:35 EST, end at Thu 2013-03-07 16:11:45 EST. --
Mar 07 15:59:30 greg dbus[277]: [system] Activating via systemd: service name='org.freedesktop.NetworkManager' unit='dbus-org.freedesktop.NetworkManager.service'
Mar 07 15:59:30 greg dbus-daemon[277]: dbus[277]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.NetworkManager.service': Unit dbus-org.freedesktop.NetworkManager.service failed to load: No such file or directory.
Mar 07 15:59:30 greg dbus[277]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.NetworkManager.service': Unit dbus-org.freedesktop.NetworkManager.service failed to load: No such file or directory. See system logs an
Mar 07 16:11:39 greg su[10097]: (to root) greg on /dev/pts/2
Mar 07 16:11:39 greg su[10097]: pam_unix(su:session): session opened for user root by greg(uid=1000)
Mar 07 16:11:45 greg systemd[1]: Starting Plex Media Server for Linux...
-- Subject: Unit plexmediaserver.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/li … temd-devel
-- Documentation: http://www.freedesktop.org/wiki/Softwar … dc7b36dcc5
--
-- Unit plexmediaserver.service has begun starting up.
Mar 07 16:11:45 greg systemd[10101]: Failed at step USER spawning /bin/sh: No such process
-- Subject: Process /bin/sh could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/li … temd-devel
-- Documentation: http://www.freedesktop.org/wiki/Softwar … 7a40a9e1e7
--
-- The process /bin/sh could not be executed and failed.
--
-- The error number returned while executing this process is 3.
Mar 07 16:11:45 greg systemd[1]: plexmediaserver.service: control process exited, code=exited status=217
Mar 07 16:11:45 greg systemd[1]: Failed to start Plex Media Server for Linux.
-- Subject: Unit plexmediaserver.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/li … temd-devel
-- Documentation: http://www.freedesktop.org/wiki/Softwar … e9d022f03d
--
-- Unit plexmediaserver.service has failed.
--
-- The result is failed.
Mar 07 16:11:45 greg systemd[1]: Unit plexmediaserver.service entered failed state
Offline
Your plexmediaserver.service file is not the one provided by the AUR package. I recommend you remove everything, including any related files that you may have installed manually outside of pacman, and then build and install the AUR package.
Offline
I removed plexmediaserver and reinstalled. Everything works Thanks
Offline
as an aside, please use [code ] tags when posting snippets
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
I'm looking for the best way to run a bash script at system start.
So far, it looks like I need to hook into systemd by writing a bastardized service file... does that sound right? Or should I use the legacy compatibility of systemd somehow?
So far this is the best I've found --
http://patrakov.blogspot.com/2011/01/wr … files.html
-- so I created testboot.service (below) into /etc/systemd/system/multi-user.target.wants/
[Unit]
Description=Random Boot Scripts
After=network.target
[Service]
ExecStart=echo "Test" > /home/user1/bash-boot-test.txt
[Install]
WantedBy=multi-user.target
With the following results:
# systemctl start testboot
Failed to issue method call: Unit testboot.service failed to load: Invalid argum
ent. See system logs and 'systemctl status testboot.service' for details.
# systemctl status testboot.service
testboot.service - Random Boot Scripts
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
Help?
Offline
I think you need to specify the path for 'echo', eg. /bin/echo "blah blah"
Offline
I take it that you agree that I'm taking a reasonable approach?
Offline
I tried the full path to echo --> same result. I'm a newb here-- my question is "How do you run your startup bash scripts?"
Offline
I had some trouble finding the relevant documentation for ExecStart.. can you point me to it?
I was looking through this:
Offline
`man systemd.directives` will help you find the man page that describes ExecStart.
Offline
Ok.. from
http://0pointer.de/public/systemd-man/s … rvice.html
ExecStart=
Commands with their arguments that are executed when this service is started. The first argument must be an absolute path name.
Which shell does ExecStart use to execute the command?
Offline
ExecStart is not a shell.
I suspect it uses exec family function (execv is likely). There is no shell.
Last edited by Trilby (2013-03-10 00:42:02)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Reading to the bottom of ExecStart:
Note that this setting does not directly support shell command lines. If shell command lines are to be used they need to be passed explicitly to a shell implementation of some kind. Example: ExecStart=/bin/sh -c 'dmesg | tac'
So I wrote:
[Unit]
Description=Random Boot Scripts
[Service]
ExecStart=/bin/bash -c "/home/user1/testboot.sh"
[Install]
WantedBy=multi-user.target
Where testboot.sh is
echo Test on `date` > /home/user1/testboot.txt
And a get a new error:
# systemctl start testboot
Failed to issue method call: Unit testboot.service failed to load: No such file
or directory. See system logs and 'systemctl status testboot.service' for detail
s.
# systemctl status testboot
testboot.service
Loaded: error (Reason: No such file or directory)
Active: inactive (dead)
I wonder if there is something I'm doing wrong in the [Unit] on [Install] sections?
Offline
You're trying to access a script (and a text file) in a users home directory. This is a bad idea, unless it is run by that user, and it is not possible if this runs before the home partition is mounted.
If this is what you actually want to do, look at systemd user sessions, otherwise, put the script somewhere else.
Also /bin/bash -c "/path/to/script" is redundant and creates two nested shells. Just use /path/to/testboot.sh
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Also /bin/bash -c "/path/to/script" is redundant and creates two nested shells. Just use /path/to/testboot.sh
... and make sure the script is executable. Alternatively, remove the -c switch.
But I'm pretty sure the error says that systemd can't find your .service file. Where did you put it and did you double-check for typos?
Offline
I'm pretty sure the error says that systemd can't find your .service file.
Ah, yes. On second look I agree. Though running something in a users home directory could still lead to antoher problem once the current one is fixed.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Solved..
I moved the script to /etc/systemd/system (rather than /etc/systemd/system/multi-user.target.wants/).. I ran
# systemctl enable testboot
and it runs at startup. Thanks!
I'm still not sure this is an advisable way to do this.. And there still may be some extra chuff in the unit file.. like After and WantedBy, but anyhow, it works
# ls /etc/systemd/system/testboot.service
/etc/systemd/system/testboot.service
# systemctl restart testboot
# systemctl status testboot.service
testboot.service - Random Boot Scripts
Loaded: loaded (/etc/systemd/system/testboot.service; disabled)
Active: inactive (dead) since Sun 2013-03-10 13:51:32 MDT; 6s ago
Process: 616 ExecStart=/usr/src/testboot.sh (code=exited, status=0/SUCC
ESS)
Mar 10 13:51:32 plugbox systemd[1]: Started Random Boot Scripts.
Which calls:
# cat /etc/systemd/system/testboot.service
[Unit]
Description=Random Boot Scripts
After=smbd.service
[Service]
Type=oneshot
ExecStart=/usr/src/testboot.sh
[Install]
WantedBy=multi-user.target
And it runs my script:
# cat /usr/src/testboot.sh
#!/bin/bash
echo `date` > /tmp/testboot.txt
Offline
Pages: 1