Shirt Pocket Discussions  
    Home netTunes launchTunes SuperDuper! Buy Now Support Discussions About Shirt Pocket    

Go Back   Shirt Pocket Discussions > SuperDuper! > General

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-20-2007, 05:32 PM
nicobos nicobos is offline
Registered User
 
Join Date: Jun 2007
Location: Netherlands
Posts: 6
Run shellscript as root

Hi all,

Before I start the copy I need to shut down groupware software and copy MySQL databases using a shell script.
After copy MySQL and groupware off course need to be started again.
These tasks need to be performed using shell scripts ran as root. How can I run a shellscript as root from SuperDuper!?

Nico
Reply With Quote
  #2  
Old 06-20-2007, 05:38 PM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,923
Send a message via AIM to dnanian
Use the before/after shell script options in Advanced Options.
__________________
--Dave Nanian
Reply With Quote
  #3  
Old 06-20-2007, 06:04 PM
nicobos nicobos is offline
Registered User
 
Join Date: Jun 2007
Location: Netherlands
Posts: 6
Yeah, but how do I run a shell script as root instead of the user that launched SuperDuper?

Nico
Reply With Quote
  #4  
Old 06-20-2007, 06:23 PM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,923
Send a message via AIM to dnanian
SD! runs that script authorized. Alternatively, you can suid the script...
__________________
--Dave Nanian
Reply With Quote
  #5  
Old 06-21-2007, 03:14 AM
nicobos nicobos is offline
Registered User
 
Join Date: Jun 2007
Location: Netherlands
Posts: 6
SD! may run authorized, but certainly not as root. I get authorization errors.
Maybe you can help me out how to suid the script.
Thanks in advance.

Nico
Reply With Quote
  #6  
Old 06-21-2007, 07:41 AM
nicobos nicobos is offline
Registered User
 
Join Date: Jun 2007
Location: Netherlands
Posts: 6
I figured it out.
From Applescript you can run a shell command authenticated as a certain user.
From shell you can run Applescript commands.
This can combined in a shellscript like:

#!/bin/tcsh -f
osascript -e 'do shell script "echo " & "MySQL is being stopped"'
osascript -e 'do shell script "/Library/StartupItems/MySQLCOM/MySQLCOM stop" user name "root" password "my secret password" with administrator privileges'
osascript -e 'do shell script "echo "& "Wait 10 seconds"'
osascript -e 'delay 10'
osascript -e 'do shell script "echo "& "MySQL databases are being copied"'
osascript -e 'do shell script "cp -f -R /usr/local/mysql-max-5.0.27-osx10.4-i686/data /usr/local/mysql-max-5.0.27-osx10.4-i686/data_backup" user name "root" password "my secret password" with administrator privileges'
osascript -e 'do shell script "echo "& "Waits 10 seconds"'
osascript -e 'delay 10'
osascript -e 'do shell script "echo "& "MySQL is being started"'
osascript -e 'do shell script "/Library/StartupItems/MySQLCOM/MySQLCOM start" user name "root" password "my secret password" with administrator privileges'

Don't forget to chmod 755 the shell script file, otherwise you will get a permission error.

Nico
Reply With Quote
  #7  
Old 06-21-2007, 08:15 AM
dnanian's Avatar
dnanian dnanian is offline
Administrator
 
Join Date: Apr 2001
Location: Weston, MA
Posts: 14,923
Send a message via AIM to dnanian
There you go!
__________________
--Dave Nanian
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
G5 (PPC, 10.4.8) keeps hanging on initial backup UniAce General 7 01-14-2007 05:13 PM
Superduper just hangs at copying stage... proximo General 12 09-23-2006 08:47 AM
Super Duper hanging user8333 General 7 09-13-2006 11:46 PM
Why might my disk images not be showing up? ScottEllsworth General 3 08-19-2006 08:42 AM
Backups using root user... jettrue General 1 01-19-2006 08:27 PM


All times are GMT -4. The time now is 05:14 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc.