LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-26-2015, 09:42 AM   #1
ramsforums
Member
 
Registered: Jun 2007
Posts: 58

Rep: Reputation: 0
User ID in Script


I am installing copy (Cloud share) application

I got the following code from link
Quote:

#!/bin/sh
### BEGIN INIT INFO
# Provides: CopyAgent
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: CopyAgent
# Description: CopyConsole (Copy cloud storage by Barracuda) service
### END INIT INFO

RUN_AS="myUser"
HOME=`grep $RUN_AS /etc/passwd | cut -d":" -f6`
CC="$HOME/copy/x86_64/CopyConsole"

start() {
echo "Starting CopyConsole..."
if [ -x $CC ]; then
start-stop-daemon -b -o -c $RUN_AS -S -u $RUN_AS -x $CC -- -daemon
fi
}

stop() {
echo "Stopping CopyConsole..."
if [ -x $CC ]; then
start-stop-daemon -o -c $RUN_AS -K -u $RUN_AS -x $CC
fi
}

status() {
dbpid=`pgrep -u $RUN_AS CopyConsole`
if [ -z $dbpid ] ; then
echo "CopyConsole for user $RUN_AS: not running."
else
echo "CopyConsole for user $RUN_AS: running (pid $dbpid)"
fi
}

case "$1" in

start)
start
;;
stop)
stop
;;
restart|reload|force-reload)
stop
start
;;
status)
status
;;
*)
echo "Usage: /etc/init.d/copy {start|stop|reload|force-reload|restart|status}"
exit 1

esac

exit 0
RUN_AS="myUser"
here what is the value for "myUser"

Should I key in actual user or
RUN_AS=$USER

Thanks

Last edited by ramsforums; 09-26-2015 at 09:43 AM.
 
Old 09-26-2015, 10:48 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by ramsforums View Post
Should I key in actual user or RUN_AS=$USER
Either should work.
but what if your cloud account name is different than your Linux "$USER" parameter?
 
Old 09-26-2015, 11:15 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 19,386

Rep: Reputation: 3087Reputation: 3087Reputation: 3087Reputation: 3087Reputation: 3087Reputation: 3087Reputation: 3087Reputation: 3087Reputation: 3087Reputation: 3087Reputation: 3087
It should be an actual user because the posted code is an init script which would run as root by default.
 
Old 09-26-2015, 12:15 PM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
It should be an actual user because the posted code is an init script which would run as root by default.
Yes, I missed that. You are correct.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Add user on raspbian + run a script on logon + logoff when user exits script EdgarE Linux - Newbie 7 09-07-2015 11:03 AM
How do i change to super user then revert back to ordinary user ,using shell script? wrapster Solaris / OpenSolaris 6 03-18-2009 04:37 AM
super user privileges check for a normal user in bash script freeindy Programming 2 08-01-2008 07:08 AM
where to get linux administrator script, ex: script to let's user change user info. hocheetiong Linux - Server 1 03-17-2008 01:06 AM
samba - add user script - User account does not exist itzamecwp Linux - Server 2 01-18-2007 11:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration