Hello, dropbox@ service regulary stops.
Since clearos 7.3 link under /etc/init.d is missing.
What is the new way to restart the dropbox-service from command line?
Thank you for an answer.
Since clearos 7.3 link under /etc/init.d is missing.
What is the new way to restart the dropbox-service from command line?
Thank you for an answer.
In Dropbox
Share this post:
Responses (7)
-
Accepted Answer
Hi Tony,
thank you for your work, but I had a chance to test right know and it does not work.
It is because
does not list the per user services.systemctl list-all-unit-files
It they were listed
should be sufficient to restart all services.systemctl start dropbox@*
Be sure I will use your bash-code as a template in other situations. -
Accepted Answer
Version to illustrate how to specify a single user...
#!/usr/bin/bash
# Version 1.0 Created 2017.03.22 by Tony G Ellis
# Version 1.1 Modified 2017.03.22 - added code to extract dropbox users
# Version 1.2 Modified 2017.03.22 - show usage if no command provided
# Version 1.3 Modified 2017.03.24 - change from ldap to systemd.wants for list of users
# Version 1.4 Modified 2017.03.25 - added optional second parameter, acts only on specific user
if ! [[ "$1" =~ ^(start|status|stop|restart|enable|disable)$ ]]; then
echo
echo 'You need to specify a command...'
echo ' '
echo 'usage # dropbox.sh command'
echo 'valid commands are... start status stop restart enable or disable'
echo 'e.g. to start all enabled dropbox users # dropbox.sh start'
echo ' '
echo 'optional usage to specify one user # "dropbox.sh command userid"'
echo 'e.g. # dropbox.sh status jsmith'
echo ' '
else
if [[ "$2" == '' ]]; then
user_list=`ls /etc/systemd/system/multi-user.target.wants/dropbox* | \
awk -F '@' '{print $2}' | awk -F '.' '{print $1" "}' | tr -d "\n"`
for user in $user_list; do
systemctl $1 dropbox@$user.service
echo 'systemctl '$1' dropbox@'$user'.service'
done
else
systemctl $1 dropbox@$2.service
fi
fi
Note that since we are using the systemd user list - "all" users is really only those that are enabled. Any users that are disabled such as by "systemctl disable dropbox@jsmith.service or using Webconfig are NOT in this systemd dropbox user list. However, they can be enabled by specifying the userid e.g. "dropbox.sh enable jsmith" or Webconfig and would then appear in systemd. Using ldap for the user list would not have this restriction and it's user list would include all those setup by Webconfig - regardless as to whether they were enabled or disabled. There is no 'best' version - depends on your requirements... the OP specified user list as in systemd.
Edit: added a little clarification... and added 'restart' to the list of valid commands -
Accepted Answer
Sorry - that is not a solution - but a really horrible workaround...
All you need is a few simple commands - this is not "elegant" - what does illustrate that you don't need to know complicated commands to create a list of users. Also have a script that uses ldap to extract the dropbox user base - but since you posted this option, albeit with a typo :-) , we will use it...
#! /usr/bin/bash
# Version 1.0 Created 2017.03.22 by Tony G Ellis
# Version 1.1 Modified 2017.03.22 - added code to extract dropbox users
# Version 1.2 Modified 2017.03.22 - show usage if no parameter provided
# Version 1.3 ToDo - add an optional second parameter which acts only on the specified user
if [[ $1 == '' ]]; then
echo 'You need to specify start, stop or status'
echo ' '
echo '# usage "dropbox.sh start" to start all dropbox users'
echo '# usage "dropbox.sh stop" to stop all dropbox users'
echo '# usage "dropbox.sh status" status of all dropbox users'
echo ' '
else
user_list=`ls /etc/systemd/system/multi-user.target.wants/dropbox* | \
awk -F '@' '{print $2}' | awk -F '.' '{print $1" "}' | tr -d "\n"`
for user in $user_list; do
systemctl $1 dropbox@$user.service
echo 'systemctl '$1' dropbox@'$user'.service'
done
fi
Works for my three users... give it a try - don't forget to make executable...
Forgot to include a sample
[root@alex bin]# ./dropbox.sh status
● dropbox@admin.service - Dropbox service for user admin
Loaded: loaded (/usr/lib/systemd/system/dropbox@.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2017-03-24 18:19:04 AEDT; 11min ago
Main PID: 31044 (sh)
CGroup: /system.slice/system-dropbox.slice/dropbox@admin.service
├─31044 /bin/sh -c /usr/libexec/dropbox/dropboxd admin | /usr/bin/install -D /dev/stdin /home/admin/.dropbox/init.log 2>&1
├─31045 /usr/libexec/dropbox/dropbox-lnx.x86_64-19.4.12/dropbox admin
└─31046 /usr/bin/install -D /dev/stdin /home/admin/.dropbox/init.log
systemctl status dropbox@admin.service
● dropbox@aellis.service - Dropbox service for user aellis
Loaded: loaded (/usr/lib/systemd/system/dropbox@.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2017-03-24 18:19:04 AEDT; 11min ago
Main PID: 31059 (sh)
CGroup: /system.slice/system-dropbox.slice/dropbox@aellis.service
├─31059 /bin/sh -c /usr/libexec/dropbox/dropboxd aellis | /usr/bin/install -D /dev/stdin /home/aellis/.dropbox/init.log 2>&1
├─31063 /usr/libexec/dropbox/dropbox-lnx.x86_64-19.4.12/dropbox aellis
└─31064 /usr/bin/install -D /dev/stdin /home/aellis/.dropbox/init.log
systemctl status dropbox@aellis.service
● dropbox@sraellis.service - Dropbox service for user sraellis
Loaded: loaded (/usr/lib/systemd/system/dropbox@.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2017-03-24 18:19:05 AEDT; 11min ago
Main PID: 31074 (sh)
CGroup: /system.slice/system-dropbox.slice/dropbox@sraellis.service
├─31074 /bin/sh -c /usr/libexec/dropbox/dropboxd sraellis | /usr/bin/install -D /dev/stdin /home/sraellis/.dropbox/init.log 2>...
├─31076 /usr/libexec/dropbox/dropbox-lnx.x86_64-19.4.12/dropbox sraellis
└─31077 /usr/bin/install -D /dev/stdin /home/sraellis/.dropbox/init.log
systemctl status dropbox@sraellis.service
Also forgot to update the version number with the change from using ldap to systemd/system/multi-user.target.wants - but that doesn't affect the operation. -
Accepted Answer
Hi Tony,
as all users who use dropbox are listed in
/etc/systemd/system/muti-user-target.wants
I could build a script as in 2) but that would be (for me) a lot of research to filter the user-names with a bash script.
My solution for now (edit):
(yum remove -y dropbox) && (yum install -y app-dropbox) -
Accepted Answer
Sure there is a way - more clues - but you are going to have to do some work - not only did I give you a clue - in fact gave you the exact command that webconfig uses. In webconfig each user is started or stopped individually. Webconfig collects a list of users and starts or stops each user going through a dropbox user list until done. So you have a few options...
1) Study the php code from the services and dropbox apps and hook into it with a script you devise.
2) Get a list a drop-box users from the Webconfig -> Cloud -> Application -> Dropbox web-page and write a little script to start of stop the list of users. Update if you add or delete users.
3) Obtain a list of users from LDAP, determine which are dropbox users, create script similar to 2). Will automatically cater for users adds/deletes.
or just use Webconfig...
Here's an idea of what 2) would look like. You could expand it to read a file containing the userids. Note you will need to verify my script - called it dropbox.sh - it's just written to give you the idea of what's required.
#! /usr/bin/bash
# Created 2017.03.22 by Tony G Ellis
# usage "dropbox.sh start" to start all dropbox users
# usage "dropbox.sh stop" to stop all dropbox users
# usage "dropbox.sh status" status of all dropbox users
for user in userid1 userid2 userid3 userid4 userid5; do
# systemctl $1 dropbox@$user.service # remove # at line beginning after testing
echo 'systemctl '$1' dropbox@'$user'.service'
done
An example for "dropbox.sh start" - the "echo" lines indicating the command that would have been executed had I removed the "#" at start of line 9
[root@alex ~]# ./dropbox.sh start
systemctl start dropbox@userid1.service
systemctl start dropbox@userid2.service
systemctl start dropbox@userid3.service
systemctl start dropbox@userid4.service
systemctl start dropbox@userid5.service
[root@alex ~]#
-
Accepted Answer
-
Accepted Answer
Here's a clue - sraellis is my userid
[root@alex ~]# systemctl status dropbox@sraellis.service
● dropbox@sraellis.service - Dropbox service for user sraellis
Loaded: loaded (/usr/lib/systemd/system/dropbox@.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2017-03-21 19:09:55 AEDT; 6min ago
Main PID: 7811 (sh)
CGroup: /system.slice/system-dropbox.slice/dropbox@sraellis.service
├─7811 /bin/sh -c /usr/libexec/dropbox/dropboxd sraellis | /usr/bin/install -D /dev/stdin /home/sraellis/.dropbox/init.log 2>&1
├─7812 /usr/libexec/dropbox/dropbox-lnx.x86_64-19.4.12/dropbox sraellis
└─7813 /usr/bin/install -D /dev/stdin /home/sraellis/.dropbox/init.log
[root@alex ~]# systemctl stop dropbox@sraellis.service
[root@alex ~]# systemctl status dropbox@sraellis.service
● dropbox@sraellis.service - Dropbox service for user sraellis
Loaded: loaded (/usr/lib/systemd/system/dropbox@.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Tue 2017-03-21 19:17:06 AEDT; 3s ago
Main PID: 7811 (code=killed, signal=TERM)
[root@alex ~]# systemctl start dropbox@sraellis.service
[root@alex ~]# systemctl status dropbox@sraellis.service
● dropbox@sraellis.service - Dropbox service for user sraellis
Loaded: loaded (/usr/lib/systemd/system/dropbox@.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2017-03-21 19:17:16 AEDT; 2s ago
Main PID: 12861 (sh)
CGroup: /system.slice/system-dropbox.slice/dropbox@sraellis.service
├─12861 /bin/sh -c /usr/libexec/dropbox/dropboxd sraellis | /usr/bin/install -D /dev/stdin /home/sraellis/.dropbox/init.log 2>&1
├─12862 /usr/libexec/dropbox/dropbox-lnx.x86_64-19.4.12/dropbox sraellis
└─12863 /usr/bin/install -D /dev/stdin /home/sraellis/.dropbox/init.log
[root@alex ~]#
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here.
Register Here »