Re: Script for Post.Office
Re: Script for Post.Office
- Subject: Re: Script for Post.Office
- From: Graff <email@hidden>
- Date: Mon, 08 Mar 2004 12:10:18 -0500
Whups, my bad. I forgot to put the divert part of that command in
there. You need to have "> /dev/null" in there somewhere.
Here is the entire statement as it should appear:
do shell script "/usr/local/post.office/post.office > /dev/null 2>&1 &"
password "userpassword" with administrator privileges
That should be all on one line. You don't need to put in "sudo" if you
use "with administrator privileges".
Also, instead of diverting to "/dev/null" (which just throws away all
output) you might want to instead divert it into a logfile of some sort
so that you can see what was output:
do shell script "/usr/local/post.office/post.office > /path/to/logfile
2>&1 &" password "userpassword" with administrator privileges
-Ken
On Mar 8, 2004, at 2:19 AM, George Priggen wrote:
Anyone -
I have tried the following suggestion:
do shell script "/usr/local/post.office/post.office 2>&1 &"
It does not open PostOffice.
I also tried the following, which was not suggested:
do shell script "sudo /usr/local/post.office/post.office 2>&1 &"
password
"userpassword" with administrator privileges
It opens PostOffice but the wheel continues without stopping.
Is there something wrong that I am doing?
George
From: Graff <email@hidden>
Date: Sun, 07 Mar 2004 23:29:39 -0500
To: AppleScript Users <email@hidden>
Subject: Re: Script for Post.Office
If you do background the command don't forget to divert stdout and
stderr to /dev/null or else the script will still wait around for the
command's output:
do shell script "/usr/local/post.office/post.office 2>&1 &"
You can find more information about this topic and about the "do shell
script"command here:
<http://developer.apple.com/technotes/tn2002/tn2065.html>
However, I totally agree with Andrew. If you want to do this right,
use a proper startup script. It's not really hard and Apple has a
tutorial page on that also:
<http://developer.apple.com/documentation/MacOSX/Conceptual/
BPSystemStartup/Tasks/CreatingStartupItems.html>
-Ken
On Mar 7, 2004, at 10:38 PM, Andrew Oliver wrote:
Umm... No. The first process won't finish, so the second one still
won't get
run.
Additionally, since Post.Office's parent process is the script, it
will
likely die when it's parent process quits, so killing the script will
probably kill post.office anyway.
The 'correct' solution (at least as far as 'do shell script' is
concerned)
is to append '&' to the end of the shell process which tells it to
background, returning control to the script while leaving the child
processes running:
do shell script "/usr/local/post.office/post.office &"
However, I still maintain the correct method of doing this is via a
normal
startup script in /System/Library/StartupItems, and controlled via
the
normal /etc/hostconfig file.
There are many reasons for taking this approach, not least is the
ability to
define dependencies (e.g. don't start Post.Office unless the network
is up).
I'm astounded that Post.Office doesn't come with a pre-installed
script just
for this purpose.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.