Re: help writing a service file for dropbox

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 22, 2014 at 12:40 PM, Steven Stern
<subscribed-lists@xxxxxxxxxxxxx> wrote:
> Can I treat a .service file like a bash script and  do all those "loop"
> sorts of things?

No, but you can invoke a bash script from a service file that does
things in a loop.  But that doesn't buy you much^D anything really
over the initial initscript.  ;-)

A proper systemdish way to accomplish this would be to use an instance
service for dropbox and use the standard systemd tools to
enable/disable it for particular users instead of keeping the list in
an /etc/sysconfig file.

First, I'd suggest reading this nice introduction to instance
services; it's not very long and afterward you'll have a full
understanding of what's going on with my example below:
http://0pointer.de/blog/projects/instances.html

To create an instance service for dropbox, instead of using
"dropbox.service", create a "dropbox@.service" file (the @ is very
important), with the following contents:
--
[Unit]
Description=Dropbox service for user %I

[Service]
ExecStart=/home/%i/.dropbox-dist/dropboxd
User=%i

[Install]
WantedBy=multi-user.target

--

Once you have that, instead of managing the users it is started for
with a file in /etc/sysconfig, just use systemctl to enable/disable it
for users as appropriate.

To enable the dropbox service for the "sdstern" user:
# systemctl enable dropbox@sdstern.service

To disable the dropbox service for the "sdstern" user later on:
# systemctl disable dropbox@sdstern.service

And, to see all the users dropbox is enabled for:
% ls /etc/systemd/system/multi-user.target.wants/dropbox@*

-T.C.
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org




[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux