Issue with shutdown command in script (MacOS High Sierra)
Hello,
I have a backup script that runs an rsync backup to an external drive. I use the script frequently on Windows and Linux and have installed it on a Mac. The script has an option to run shutdown after the backup has completed. Since backup can take hours to run, this is an option that is set when the script starts and is executed when the script is finished (usually long after I have gone to bed).
The script looks more or less like this,
This works well on Linux and Windows cygwin. In MacOS, the backup works correctly, but I get an error from the shutdown command that I am not super user. This does not happen under Windows or Linux, I guess because I am running from an account with administrator. My user account on MacOS is administrator, but sudo appears frequently and apparently shutdown is one of the tasks that requires password authentication.
I can add a command to switch to super user, sudo su , so that when the user specifies that they want to shutdown they can enter their password (you have to use sudo to switch to su in MacOS, more or less).
That version looks like,
It looks like sudo su opens a new subshell and so the script does not continue to run. I really can't see an easy way around this. Maybe I could have a calling script that would run two different versions of the backup script, one called with sudo and the other not, but I'm not sure about that.
I have Oracle 9i R2 on AIX 5.2. My Database is running in shared server mode (MTS).
Sometimes when I shutdown the database it shutsdown cleanly in 4-5 mints and sometimes it takes good 15-20 minutes and then I get some ora-600 errors and only way to shutdown is by opening another session and... (7 Replies)
I'm trying to compile Linpack on a Ubuntu cluster. I'm running MPI. I've modified the following values to fit my system TOPdir MPdir LAlib CC LINKER.
When compiling I get the following error: (the error is at the end, the other errors in between are because I've ran the script several times so... (0 Replies)
Hi ,
I am trying to :wall: my head while scripting ..I am really new to this stuff , never did it before :( .
how to find cpu's system high time and user time high in a script??
thanks , help would be appreciated !
:) (9 Replies)
This is probably a simple question, but I'm new with writing scripts for Linux (IPFire in this case) and Google wasn't helpful with this.
When creating a script, what is the best and/or proper way to have it exit automatically if the reboot or shutdown command is given? If that's even... (2 Replies)
Hello everyone!
I'm developing a MacOs Application in python and I'm having some issues trying to find information related to the power button pressed event. I know that in Ubuntu 14.04 you can find information about it on the acpi folders, but I realized that here in Mac that process is... (0 Replies)
Some hackers found a security hole in macOS High Sierra and tweeted it to the world before telling Apple about the problem. You can see the details from PC Magazine's daily news here: Apple Releases Fix for MacOS High Sierra 'Root' Bug. The original story this morning was published before a patch... (6 Replies)
the only way we can power off is if we actually press power button on server. Running on HP DL-G4. from root, when we issue command it just returns to root prompt. (1 Reply)
Hello,
I have the following script that just archives and clears some log files.
#!/bin/bash
# script: archive_logs_and_clear
# add date to logfile names and copy archive directory
# clear logs
# change to script directory
cd ... (4 Replies)
Hello,
I am running a bash script to do an rsync back on a computer running MacOS High Sierra. This is the script I am using,
#!/bin/bash
# main backup location, trailing slash included
backup_loc="/Volumes/Archive_Volume/00_macos_backup/"
# generic backup function
function backup {... (12 Replies)
Mac Version 10.15.2 (macOS Catalina)
Does anyone know how to change the name of a connected bluetooth device from the command line on macOS?
I am having trouble with various bluetooth devices which I cannot get the "rename" option in the GUI to "save" properly and so I cannot rename a few... (0 Replies)