You are not logged in.

#1 2013-02-18 02:27:32

akspecs
Member
Registered: 2012-02-11
Posts: 169

Doh! How do I make a simple systemd service...? [SOLVED]

I've procrastinated long enough.

I have a few symbolic links from various locations that all lead to directories in /tmp or /dev/shm.  These directories were simply created by mkdir in rc.local, and I've forgotten about it sometime ago.

I want systemd to do something like:

mkdir -p /tmp/foo/bar
chmod -R o+rw /tmp/foo/bar

everytime I start up my computer.   I used to have it all in rc.local and it's far simpler than what most people's startup scripts look like.

I tried making this service file, but I'm doing something wrong (due to my lack of understanding, please forgive me).  It shows up as a static service.

[Unit]
Description=rc.local ported to systemd

[Service]
Type=oneshot
ExecStart=/usr/local/bin/rc.local

The rc.local file referenced was simply copied before initscripts were removed.  It contains the series of mkdir and chmod commands (and nothing more).

-ak

Last edited by akspecs (2013-02-18 03:27:43)

Offline

#2 2013-02-18 02:30:01

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,675

Re: Doh! How do I make a simple systemd service...? [SOLVED]

I *think* the way to do this is with temp files but I've never actually had to use these myself. Bound to be in the wiki, though.


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#3 2013-02-18 02:43:40

progandy
Member
Registered: 2012-05-17
Posts: 2,152

Re: Doh! How do I make a simple systemd service...? [SOLVED]

cfr wrote:

I *think* the way to do this is with temp files but I've never actually had to use these myself. Bound to be in the wiki, though.

the manpage for this is tmpfiles.d (5).

Offline

#4 2013-02-18 03:27:19

akspecs
Member
Registered: 2012-02-11
Posts: 169

Re: Doh! How do I make a simple systemd service...? [SOLVED]

Thanks for the quick replies.  This is a much better alternative.

Offline

Board footer

Powered by FluxBB