You are not logged in.

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

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

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: 7,131

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.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

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

progandy
Member
Registered: 2012-05-17
Posts: 5,184

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).


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

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

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

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