Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 6, 2013, 06:08 PM   #1
skinicod
macrumors newbie
 
Join Date: Jul 2013
Shell Script Running and Password Problems

Hello All,

I have written the following script, which is intended to run at login:

Code:
mv /Library/"Application Support"/Digidesign/"Plug-Ins"/* /Library/"Application Support"/Digidesign/"Plug-Ins (Unused)"/

file=~/Desktop/"Plugins List.txt"
while IFS= read -r line
do
        mv "/Library/Application Support/Digidesign/Plug-Ins (Unused)/$line" "/Library/Application Support/Digidesign/Plug-Ins/"
done <"$file"
mv "/Library/Application Support/Digidesign/Plug-Ins (Unused)"/XPand* "/Library/Application Support/Digidesign/Plug-Ins/"
The code runs fine except for certain files I get the following feedback:

Code:
mv: rename /Library/Application Support/Digidesign/Plug-Ins (Unused)/Wurlitzer V.dpm to /Library/Application Support/Digidesign/Plug-Ins/Wurlitzer V.dpm: Permission denied
I have changed the ownership of the shellscript to be root:admin, and added a line to my visudo:

Code:
# User privilege specification
root    ALL=(ALL) ALL
%admin  ALL=(ALL) ALL
OldBoyMusic     ALL=(ALL) NOPASSWD:/plugin.sh
Any ideas why these files are not copying? if I log into terminal as a root user I can move them with no problems at all.

Secondly, does anyone know how I can get this script to run at login, I have tried setting up a plist in LaunchAgents, but this has not worked.

Thanks in advance for your responses,

cheers,

skinicod.
skinicod is offline   0 Reply With Quote
Old Jul 7, 2013, 01:47 AM   #2
subsonix
macrumors 68040
 
Join Date: Feb 2008
Quote:
Originally Posted by skinicod View Post
Secondly, does anyone know how I can get this script to run at login, I have tried setting up a plist in LaunchAgents, but this has not worked.
The absolute easiest way is to use login items, you just need to add your script there. It's in system preferences under accounts.
subsonix is offline   1 Reply With Quote
Old Jul 7, 2013, 01:51 AM   #3
Dalton63841
macrumors 65816
 
Dalton63841's Avatar
 
Join Date: Nov 2010
Location: SEMO, USA
Found this to help automate sudo commands. Might be worth giving a shot.

Code:
if [ $UID -ne 0 ]; then
sudo $0
else

<SCRIPT GOES HERE>

fi
__________________
mid-2009 13" Macbook Pro, 2.26Ghz, 8GB RAM, 120GB SSD + 1TB HDD
Dalton63841 is offline   1 Reply With Quote
Old Jul 7, 2013, 06:25 PM   #4
skinicod
Thread Starter
macrumors newbie
 
Join Date: Jul 2013
Amazing, thank you both - exactly what I needed. In case anyone is interested I found this link - which describes how to make a shellscript run in the background, by making it part of an AppleScript App.

Thanks again,

Skinicod.
skinicod is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Apple script batch shell script prramesh Mac Programming 5 Sep 15, 2013 03:35 AM
AudioScope.sh shell script... wisecracker MacBook Pro 0 Jul 31, 2013 01:31 PM
Anyone know how to use AppleScript or shell-script? gba2000 Mac Applications and Mac App Store 0 Apr 23, 2013 11:14 AM
How to create a shell script and run it? Killwin98 Mac Programming 3 Mar 18, 2013 06:39 PM
Need help with a shell script thatgreenvw Mac Programming 1 Nov 30, 2012 07:55 AM

Forum Jump

All times are GMT -5. The time now is 07:48 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC