Issue with pwd for script run by double click on script (MacOS High SIerra)
Hello,
I have the following script that just archives and clears some log files.
The issue is the text in red text where I have to hard code a cd to change pwd to the directory where the script file is located.This file is located on the backup drive in the backup directory structure where the log files are written. When I start the script by a double click, pwd defaults to the user home directory and not to where the script is located. I have to make my way over to the script directory or my ls doesn't find anything,etc. This is not a major issue for this case, though I believe it to be in-elegant to have to hard code the script location.
There are other cases where I may have this script on an external drive where it would not be so easy to know the script location ahead of time to code the path. Is there a way to tell make pwd be the directory where the script file is located, or at least automate the location of the script and the cd path?
The script to get the db user password from LDAP does not work on AIX 5.3. It's using bash. Our current shell is /usr/bin/shell.
How can i make changes to this script so that it can run on aix with current shell with out installing bash.
We tried making but din't work.
... (0 Replies)
Hi there,
i was presented with a challenge that is beyond my current shell knowledge: how can you have a script that executed interactive will change your current working directory?
Example (under MacOS):
1. start Terminal and my current working directory is my home folder
2. execute a... (3 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)
Hi ppl hope to have your advice, i am run out of idea...
I have 3 scripts: a.sh, b.sh, and c.sh
a.sh resided in /etc/init.d
b.sh and c.sh /opt/xSystem
I intend to start my system with "service" command which will trigger my a.sh
service a.sh start
then.
a.sh will trigger... (4 Replies)
how can i get the absolute path of whatever directory a script and/or command is in when it is run?
i want to know the directory. say for instance, if i were to run the "who" command, i want to know exaclty where the who command is located.
if a user ran a script, i want to know where there... (2 Replies)
when user types "pwd.sh joe" at command line, it generates pwd as abc123 and when user types "pwd.sh jane" at command line, it generates pwd as abc123.
pwd will change every 90 days.
my pwd file will be always abc123 until i change joe/jane/bob pwd manually. (3 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)
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)
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... (10 Replies)
Discussion started by: LMHmedchem
10 Replies
LEARN ABOUT DEBIAN
service
service(8) System Manager's Manual service(8)NAME
service - run a System V init script
SYNOPSIS
service SCRIPT COMMAND [OPTIONS]
service --status-all
service --help | -h | --version
DESCRIPTION
service runs a System V init script in as predictable an environment as possible, removing most environment variables and with the current
working directory set to /.
The SCRIPT parameter specifies a System V init script, located in /etc/init.d/SCRIPT. The supported values of COMMAND depend on the
invoked script. service passes COMMAND and OPTIONS to the init script unmodified. All scripts should support at least the start and stop
commands. As a special case, if COMMAND is --full-restart, the script is run twice, first with the stop command, then with the start com-
mand.
service --status-all runs all init scripts, in alphabetical order, with the status command.
EXIT CODES
service calls the init script and returns the status returned by it.
FILES
/etc/init.d
The directory containing System V init scripts.
ENVIRONMENT
LANG, TERM
The only environment variables passed to the init scripts.
SEE ALSO
/etc/init.d/skeleton,
update-rc.d(8),
init(8),
invoke-rc.d(8).
Jan 2006 service(8)