[solved] systemd shutdown scripts
I'm trying to configure network-ups-tools to properly shutdown UPS after system is halted, so UPS and server could restart when the line power is regained. network-ups-tools contains /usr/lib/systemd/system-shutdown/nutshutdown shell script which checks if shutdown was caused by nut-monitor daemon and in this case shuts down the UPS. Unfortunately it seems that script isn't executed.
According to man systemd-shutdown:
Immediately before executing the actual system halt/poweroff/reboot/kexec systemd-shutdown will run all executables in /usr/lib/systemd/system-shutdown/ and pass one arguments to them: either "halt", "poweroff", "reboot" or "kexec", depending on the chosen action.
It sounds logical to use this feature rather than service executed at shutdown as this script will immediately cut the power.
I've created /usr/lib/systemd/system-shutdown/test.sh which writes echo $1 to file, but it also does not seem to be executed. What am I doing wrong?
Last edited by denn (2013-11-29 07:12:20)
Right, I use this feature also for my UPS (APC). Did you set the right file mode (0755) ?
In my case:
/usr/lib/systemd/system-shutdown/apc_killpower
#!/bin/sh
if [ -f /etc/apcupsd/powerfail -a "$1" = "poweroff" ]; then
/etc/apcupsd/apccontrol killpower
fi
At that point / is mounted ro, your file should be writed to /run for example, then from "initramfs" after pivot_root (if you have enabled shutdown hook) you can see it (just execute "ash" in /run/initramfs/shutdown at some point , ie just before poweroff
Similar Messages
-
Is there a counterpart to 'After=' for shutting down services in a particular order?
I wrote a unit file that shall wrap an old init-script which handles initialization and backup of some ramdisks (tmpfs):
[Unit]
Description=Persistent ramdisks
Requires=local-fs.target
After=local-fs.target
[Service]
Type=simple
RemainAfterExit=true
ExecStart=/etc/rc.d/ramdisks start
ExecStop=/etc/rc.d/ramdisks stop
[Install]
WantedBy=graphical.target
Startup works fine and in the correct order, but when it comes to shutdown the 'ExecStop=' command is issued late: local filesystems are often unmounted already and my ramdisks are lost.
Any idea how to make sure the stop command gets executed before local filesystems are unmounted?
Regards,
lynixPlace the script in /usr/lib/systemd/system-shutdown/ see systemd-shutdown(8).
Example: https://wiki.archlinux.org/index.php/Us … ra#apcupsd
PS: I love trance!
Last edited by djgera (2012-11-05 14:35:48) -
Hello @all,
i would like to create a shutdown script, which depends on a working network connections.
So i've created a StartupItem script and placed it under /Library/StartupItems
The script works as expected when i called it via:
SystemStarter -D stop <NameOfMyScript>
The StartupParameters.plist of my script looks like this:
Requires = ("Disks","Network");
The problem now is that during shutdown procedure the network interfaces are already down.
Maybe this is done by launchd?
Any ideas/hints?
Thank you very much for your support.
CheersAFAIK, StartupItems are deprecated and such tasks should be migrated to Launchd.
In addition the Requires parameter only affects startup ordering and delays the task startup until the prerequisites are in place. I don't think it has any effect on shutdown actions.
That said, I don't know that launchd handles this any better - there is no dependency model in launchd - the script is supposed to handle that itself.
launchd does have a NetworkState flag that will keep your process alive as long as there's a network connection but I don't believe this will inform you that the network is going to go down - you may be able to detect when it's gone, but that doesn't sound like it'll solve your issue, either.
Therefore I think you need to consider what it is you're doing (or trying to do) and look for some other way of doing it. Typically the application/process would have to deal with a network issue so that's where I'd look. -
Oracle 11gR2 systemd startup script
I would like to write down the systemd startup script here for I can't find any on the internet. wish people don't have to browse around and find nothing.
everything on internet is about 9i and no systemd startup script example.
I hv tried several times that the script runs right and start up oracle at bootup.
Issuing systemctl and it returns the following
oracle.service loaded active exited Oracle database serverthe script is working on my Fedora 18 x86_64.
Please give your input if you find mistake, error, or anything wrong.
Thank you
oracle.service
[Unit]
Description=Oracle database server
After=syslog.target network.target
[Service]
Type=oneshot
User=oracle
Group=oinstall
RemainAfterExit=yes
ExecStart=/bin/oracle.sh;
[Install]
WantedBy=multi-user.targetoracle.sh
#! /bin/bash
# script used by oracle.service
ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
ORACLE_SID=orcl
ORACLE_BASE=/home/oracle/app/oracle/product/11.2.0
$ORACLE_HOME/bin/lsnrctl start;
$ORACLE_HOME/bin/dbstart $ORACLE_HOME;newbieRyan wrote:
I would like to write down the systemd startup script here for I can't find any on the internet. wish people don't have to browse around and find nothing.
everything on internet is about 9i and no systemd startup script example.Really??!?!?!
I googled 'start oracle on linux startup" and the very first hit is pretty much the standard reference on the subject: http://www.oracle-base.com/articles/linux/automating-database-startup-and-shutdown-on-linux.php
I hv tried several times that the script runs right and start up oracle at bootup.
Issuing systemctl and it returns the following
{code}
oracle.service loaded active exited Oracle database server
{code}
the script is working on my Fedora 18 x86_64.
Please give your input if you find mistake, error, or anything wrong.
Thank you
oracle.service
{code}
[Unit]
Description=Oracle database server
After=syslog.target network.target
[Service]
Type=oneshot
User=oracle
Group=oinstall
RemainAfterExit=yes
ExecStart=/bin/oracle.sh;
[Install]
WantedBy=multi-user.target
{code}
oracle.sh
{code}
#! /bin/bash
# script used by oracle.service
ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
ORACLE_SID=orcl
ORACLE_BASE=/home/oracle/app/oracle/product/11.2.0
$ORACLE_HOME/bin/lsnrctl start;
$ORACLE_HOME/bin/dbstart $ORACLE_HOME;
{code} -
Error in shutdown script for bea weblogic
We have this error in the shutdown script of our bea weblogic:
./stopWebLogic.sh[33]: -Xms256m: not found.
using the Oracle OCI database driver
Shutdown initiated
The shutdown sequence has been initiated.the script is as follows:
echo "using the Oracle OCI database driver"
export ORACLE_HOME=/opt/oracle/product/8.1.7
export NLS_LANG=AMERICAN_AMERICA.UTF8
export ORACLE_CLIENT_VERSION=817
export ORACLE_API_VERSION=8
PATH=$PATH:$ORACLE_HOME/bin
SHARED_LIBRARY_PATH=$WEBLOGIC_HOME/lib/hpux11:$WEBLOGIC_HOME/lib/hpux11/oci$ORACLE_CLIENT_VERSION\_$ORACLE_API_VERSION:$ORACLE
_HOME/lib
PATH=$JDK_HOME/bin:$PATH
export PATH
# Set application specific variables
DOMAIN_NAME=eGovStarters
SERVER_NAME=MyServer
WLS_PW=weblogic
# change to domain directory
cd $WEBLOGIC_HOME/config/$DOMAIN_NAME
# Allow other users in group to see created files - i.e. logfiles
umask 027
# Set system classpath initially to contain WebLogic product JARs
CLASSPATH=$WEBLOGIC_HOME:$WEBLOGIC_HOME/lib/weblogic.jar
#!/bin/sh
# Weblogic start script for egovernment
# Based on Colin Brick's initial version
# Modified 02/04/03 - Colin Brick
# - included settings for Oblix from using SSO Assembly Test as example
# Set General environment variables (Should normally not be changed)
#Java settings
JDK_HOME=/opt/bea/jdk131/
export JDK_HOME
JAVACMD=java
JAVA_OPTIONS=""-server -Xms1024m -Xmx1024m -Xmn320m -XX:SurvivorRatio=8 -Xverbosegc:file=/opt/bea/wlserver6.1/config/eGovStart
ers/logs/gc.log -Dweblogic.system.gc.enabled=false ""
export JAVA_OPTIONS
WEBLOGIC_PORT=51080
#Bea settings
BEA_HOME=/opt/bea
export BEA_HOME
WEBLOGIC_HOME=/opt/bea/wlserver6.1
export WEBLOGIC_HOME
BEA_SECURITY_POLICY=/opt/bea/wlserver6.1/lib/weblogic.policy
export BEA_SECURITY_POLICY
#Oracle settings
echo "using the Oracle OCI database driver"
export ORACLE_HOME=/opt/oracle/product/8.1.7
export NLS_LANG=AMERICAN_AMERICA.UTF8
export ORACLE_CLIENT_VERSION=817
export ORACLE_API_VERSION=8
PATH=$PATH:$ORACLE_HOME/bin
SHARED_LIBRARY_PATH=$WEBLOGIC_HOME/lib/hpux11:$WEBLOGIC_HOME/lib/hpux11/oci$ORACLE_CLIENT_VERSION\_$ORACLE_API_VERSION:$ORACLE
_HOME/lib
PATH=$JDK_HOME/bin:$PATH
export PATH
# Set application specific variables
DOMAIN_NAME=eGovStarters
SERVER_NAME=MyServer
WLS_PW=weblogic
# change to domain directory
cd $WEBLOGIC_HOME/config/$DOMAIN_NAME
# Allow other users in group to see created files - i.e. logfiles
umask 027
# Set system classpath initially to contain WebLogic product JARs
CLASSPATH=$WEBLOGIC_HOME:$WEBLOGIC_HOME/lib/weblogic.jar
domain_NAME=eGovStarters
SERVER_NAME=MyServer
WLS_PW=weblogic
# change to domain directory
cd $WEBLOGIC_HOME/config/$DOMAIN_NAME
# Allow other users in group to see created files - i.e. logfiles
umask 027
# Set system classpath initially to contain WebLogic product JARs
CLASSPATH=$WEBLOGIC_HOME:$WEBLOGIC_HOME/lib/weblogic.jar
#Set the shared library path
if [ -n "$SHLIB_PATH" ]; then
SHLIB_PATH=$SHLIB_PATH:$SHARED_LIBRARY_PATH
else
SHLIB_PATH=$SHARED_LIBRARY_PATH
fi
export SHLIB_PATH
# Start weblogic
# change to weblogic home
cd $WEBLOGIC_HOME
PATH=$WL_HOME/bin:$JAVA_HOME/jre/bin:$JAVA_HOME/bin:$PATH
$JAVACMD -classpath $CLASSPATH -Dbea.home=$BEA_HOME -Dweblogic.Domain=$DOMAIN_NAME -Dweblogic.Name=MyServer weblogic.Admin -ur
l t3://localhost:$WEBLOGIC_PORT -username system -password $WLS_PW SHUTDOWNIt has obviously something to do with the line
JAVA_OPTIONS=""-server -Xms1024m -Xmx1024m -Xmn320m -XX:SurvivorRatio=8 -Xverbosegc:file=/opt/bea/wlserver6.1/config/eGovStart
ers/logs/gc.log -Dweblogic.system.gc.enabled=false ""I googled for this Xms1024m, Xmx1024m and it turns out to be for memory management for the java virtual machine.
I don't know why it sais it can't find "-Xms256m" since it's not in the script.
Anyone with some experience in this field who can help me out?./stopWebLogic.sh[33]: -Xms256m: not found.
this can be produced by something like this:
javaoptions="-Xms256m" // or other option too
$javacmd $javaoptions
Now if javacmd has not been set, then $javacmd will be evaluated to the empty string, and the program to look for is the first part in $javaoptions, -Xms256m in our case. -
[SOLVED] advanced shell script for mount and unmount samba share
Good morning guys,
Today I've a very long question....
Hope in your help....:
I usually move from different network.
For one of those I need to mount some share that are under an ActiveDirectory server.
To do that I use samba.
Especially I've made and use the below shell script.
I know that it's so stupid but I'm a very newbie:
#!/bin/sh
echo "This is a custom script for mount my citrix share"
echo "Please insert user password (must a sudoer user)"
echo " "
sudo mount -t cifs -o username='myusername',password='mypassword' //host_ip/TsHome$/myusername /home/myuser/samba_share/TsHOME
sudo mount -t cifs -o username='myusername',password='mypassword' "//host_ip/direction" /home/myuser/samba_share/direction
echo " "
read -p "Press ENTER key to close this terminal"
exit
As I say the script work but it's so crude...!
I want/need to implement it whit the follow addictions:
1. print a feedback on mount: somenthing like "TsHOME is now mounted" or "unable to mount TsHOME"
2. check if the share are already mounted: to prevent accidentally multiple mount. If a share is already mounted I want to print something like "TsHOME is already mounted on /home/myuser/samba_share/TsHOME"
3. ask for share password (now it's in clear on script) - This is optinal
4. un-mount the share before reboot or shutdown command. That because I've notice that If i reboot or shutdown without manually un-mount the share the step of unmounting network file system became very slow
If it's no extremely difficult, can someone help me to write this script?
I know that man exist but I'm not a programmer and it's so difficult for me approch it.
Thank you in advance.
Ale
Last edited by Alexbit (2010-09-23 21:29:13)Thank you very (VERY) much!
I've follow your information and.. it work!
If can be usefull to other this is the complete script:
#!/bin/sh
echo "This is a custom script for mount citrix share"
echo "****************************************"
echo " "
echo "Please insert domain password:"
read -s mypassword
echo " "
echo "|checking mount state...in share are not mounted mount it!|"
echo "+-------------------------------------------------------------------------+"
if grep "TsHome" /etc/mtab &>/dev/null; then
grep "TsHome" /etc/mtab | awk '{print "TsHome is already mounted on " $2}'
else
sudo mount -t cifs -o username='yourusername',password="$mypassword" //ipaddress/TsHome$ /home/Samba_share/TsHOME && echo "TsHOME is now mounted" || echo "unable to mount TsHOME"
fi
echo " "
if grep "direction" /etc/mtab &>/dev/null; then
grep "direction" /etc/mtab | awk '{print "direction is already mounted on " $2}'
else
sudo mount -t cifs -o username='yourusername',password="$mypassword" '//ipaddress/direction' /home/Samba_share/direction' && echo "direction pat is now mounted" || echo "unable to mount direction"
fi
echo " "
if grep "Area" /etc/mtab &>/dev/null; then
grep "Area" /etc/mtab | awk '{print "Area is already mounted on " $2}'
else
sudo mount -t cifs -o username='yourusername',password="$mypassword" '//ipaddress/Area' /home/Samba_share/Area && echo "Area is now mounted" || echo "unable to mount Area"
fi
echo " "
echo "All DONE!"
echo " "
read -p "Press ENTER key to close this terminal"
exit
I don't really well understand what I've to put in rc.local.shutdown....
I think somethings like:
#!/bin/bash
# /etc/rc.local.shutdown: Local shutdown script.
echo "This is a custom script for UN-mount citrix share"
echo "********************************************"
echo " "
echo "|check mount state: if mount then un-mount!|"
echo "+-------------------------------------------------------+"
echo " "
if grep "TsHome" /etc/mtab &>/dev/null; then
grep "TsHome" /etc/mtab | awk '{print "TsHome is NOT mounted -> going on..." $2}'
else
sudo umount /home/Samba_share/TsHOME && echo "TsHOME is now UN mounted" || echo "unable to UN-mount TsHOME"
fi
echo " "
if grep "direction" /etc/mtab &>/dev/null; then
grep "direction" /etc/mtab | awk '{print "direction is NOT mounted -> going on.." $2}'
else
sudo umount /home/Samba_share/direction && echo "direction is now UN mounted" || echo "unable to UN-mount direction pat"
fi
echo " "
if grep "Area" /etc/mtab &>/dev/null; then
grep "Area" /etc/mtab | awk '{print "Area is NOT mounted - Finished" $2}'
else
sudo umount /home/Samba_share/Area && echo "Area is now UN mounted" || echo "unable to UN-mount Area"
fi
echo " "
echo "going shutdown"
echo " "
sleep 5
I've try but it seems to ignore the IF statement... this is the output when ALL share are UNmounted:
$ sh /etc/rc.local.shutdown
This is a custom script for UN-mount citrix share
|check mount state: if mount then un-mount!|
+-------------------------------------------------------+
umount: /home/Samba_share/TsHOME: not mounted
unable to UN-mount TsHOME
umount: /home/Samba_share/direction: not mounted
unable to UN-mount direction
umount: /home/Samba_share/Area: not mounted
unable to UN-mount Area
going shutdown
Tomorrow I will test again when I'm at office.
Meanwhile can you check if I made a macroscopic mistakes?
Thank you again!
Last edited by Alexbit (2010-09-23 17:34:49) -
GPO Startup/Shutdown scripts not running
I am running server 2003 SBS with windows 8.1 Pro workstations.
My workstations run 1 start-up script and 2 shutdown scripts. All are BAT files.
They were all working fine last week before I ran the update for 8.1.1, now they do not run at the appropriate time on any of those systems. However, if I execute them manually they work as expected.
I have checked to see if the BAT files are still located in the GPO and they are there. They are stored locally on each machine, I have even tried to delete and re-add them and then run GPUPDATE to no avail.
Any help here would be great, as they deal with local encrypted containers and are specific to each workstation.Hi Sebastian,
Thanks for posting.
Whether the GPO with start-up/shutdown scripts are linked to the OU containing computers?
FYI - Logon/Logoff scripts could only be applied to users, whereas Start-up/Shutdown scripts applies to computers.
Also, checkout the below thread on similar discussion,
http://social.technet.microsoft.com/Forums/windowsserver/en-US/b193e8a9-9b2a-4993-bd74-836c65c51dc3/gpo-with-a-startup-script-is-not-working
Regards,
Gopi
www.jijitechnologies.com -
Startup/Shutdown script for OBIEE 11g on Linux
Hi all,
as a follow-up to [url http://forums.oracle.com/forums/thread.jspa?messageID=4546010]an earlier thread by some fine gentleman, I have improved the original startup/shutdown script for Linux a bit, making sure that all processes are handled correctly. The script has been tested and works fine on CentOS 5.5 with Oracle BI 11.1.1.3.0 in a clustered configuration. Instructions:
Manual start/stop:
> service obiee start
> service obiee stop
> service obiee status
Automatic start/stop during boot sequence:
> chkconfig --add obiee
> chkconfig obiee on
Note that in order for the procedure to go through smoothly, you need to provide the admin credentials (username/password, defaulting to weblogic/weblogic) in three different places:
1. In configuration file <FMW_HOME>/user_projects/domains/<domain name>/servers/AdminServer/security/boot.properties for the administration server;
2. In script <FMW_HOME>/user_projects/domains/<domain name>/bin/startManagedWebLogic.sh (variables WLS_USER and WLS_PW) for the managed server;
3. In the startup script itself (variables BIEE_USER and BIEE_PASSWD) for shutting down the managed server.
Complete logs are available in /var/log/obiee-start (-stop).log files.
Please comment as necessary,
Chris
#!/bin/bash
# File: /etc/init.d/obiee
# Purpose: Start and stop Oracle Business Intelligence 11g components.
# chkconfig: 2345 99 10
# description: Manage OBIEE service.
# These values must be adapted to your environment.
ORACLE_OWNR=oracle # Local Unix user running OBIEE
ORACLE_FMW=/home/oracle/biee # Deployment root directory
BIEE_USER=<username> # BIEE administrator name
BIEE_PASSWD=<password> # BIEE administrator password
BIEE_DOMAIN=<domain name> # Domain name
BIEE_INSTANCE=instance1 # Instance name
BIEE_SERVER=bi_server1 # Server name
BIEE_MANAGER_URL=<hostname>:7001 # Admin server URL (hostname:port)
# These should require no change.
WL_PATH=$ORACLE_FMW/wlserver_10.3/server/bin
BIEE_PATH=$ORACLE_FMW/user_projects/domains/$BIEE_DOMAIN/bin
ORACLE_INSTANCE=$ORACLE_FMW/instances/$BIEE_INSTANCE
export ORACLE_INSTANCE
START_LOG=/var/log/obiee-start.log
STOP_LOG=/var/log/obiee-stop.log
SUBSYS=obiee
start() {
echo "********************************************************************************"
echo "Starting Admin Server on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$BIEE_PATH/startWebLogic.sh" &
wait_for "Server started in RUNNING mode"
echo "********************************************************************************"
echo "Starting Node Manager on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$WL_PATH/startNodeManager.sh" &
wait_for "socket listener started on port"
echo "********************************************************************************"
echo "Starting Managed Server $BIEE_SERVER on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$BIEE_PATH/startManagedWebLogic.sh $BIEE_SERVER http://$BIEE_MANAGER_URL" &
wait_for "Server started in RUNNING mode"
echo "********************************************************************************"
echo "Starting BI components on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$ORACLE_INSTANCE/bin/opmnctl startall"
echo "********************************************************************************"
echo "OBIEE start sequence completed on $(date)"
echo "********************************************************************************"
stop() {
echo "********************************************************************************"
echo "Stopping BI components on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$ORACLE_INSTANCE/bin/opmnctl stopall"
echo "********************************************************************************"
echo "Stopping Managed Server $BIEE_SERVER on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$BIEE_PATH/stopManagedWebLogic.sh $BIEE_SERVER t3://$BIEE_MANAGER_URL $BIEE_USER $BIEE_PASSWD"
echo "********************************************************************************"
echo "Stopping Node Manager on $(date)"
echo "********************************************************************************"
pkill -TERM -u $ORACLE_OWNR -f "weblogic\\.NodeManager"
echo "********************************************************************************"
echo "Stopping Admin Server on $(date)"
echo "********************************************************************************"
su $ORACLE_OWNR -c "$BIEE_PATH/stopWebLogic.sh"
echo "********************************************************************************"
echo "OBIEE stop sequence completed on $(date)"
echo "********************************************************************************"
wait_for() {
res=0
while [[ ! $res -gt 0 ]]
do
res=$(tail -5 "$START_LOG" | fgrep -c "$1")
sleep 5
done
case "$1" in
start)
echo "********************************************************************************"
echo "Starting Oracle Business Intelligence on $(date)"
echo "Logs are sent to $START_LOG"
echo "********************************************************************************"
start &> $START_LOG &
touch /var/lock/subsys/$SUBSYS
stop)
echo "********************************************************************************"
echo "Stopping Oracle Business Intelligence on $(date)"
echo "Logs are sent to $STOP_LOG"
echo "********************************************************************************"
stop &> $STOP_LOG
rm -f /var/lock/subsys/$SUBSYS
status)
echo "********************************************************************************"
echo "Oracle BIEE components status...."
echo "********************************************************************************"
su $ORACLE_OWNR -c "$ORACLE_INSTANCE/bin/opmnctl status"
restart)
$0 stop
$0 start
echo "Usage: $(basename $0) start|stop|restart|status"
exit 1
esac
exit 0You can use WLST to start/stop BI Services and it works on both Linux and Windows.
Following link has the sample -
http://download.oracle.com/docs/cd/E21764_01/bi.1111/e10541/admin_api.htm#CDEFAHDD -
Shutdown script for awesome wm
I`m writing a shutdown script for my awesome wm.
it looks like this
[c!/bin/bash
ACTION=`zenity --width=90 --height=200 --list --radiolist --text="Select logout action" --title="Logout" --column "Choice" --column "Action" TRUE Shutdown FALSE Reboot FALSE LockScreen FALSE Suspend`
if [ -n "${ACTION}" ];then
case $ACTION in
Shutdown)
#zenity --question --text "Are you sure you want to halt?" &&
dbus-send --system --print-reply \
--dest=org.freedesktop.ConsoleKit \
/org/freedesktop/ConsoleKit/Manager \
org.freedesktop.ConsoleKit.Manager.Stop
Reboot)
#zenity --question --text "Are you sure you want to reboot?" && gksudo reboot
dbus-send --system --print-reply \
--dest=org.freedesktop.ConsoleKit \
/org/freedesktop/ConsoleKit/Manager \
org.freedesktop.ConsoleKit.Manager.Restart
Suspend)
#gksudo pm-suspend
dbus-send --system --print-reply --dest=org.freedesktop.Hal \
/org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.SystemPowerManagement.Suspend int32:0
LockScreen)
slock
esac
fi
and i makedd it executable with chmod +x. But it sims that she is not working.When i run it as root the script works.And when i run it like user onli suspend semams to working.You don't have to use the deprecated hal! Here are my scripts which I use(d). All you need is
exec ck-launch-session awesome
in your .xinitrc.
shutdown
#!/bin/bash
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
reboot
#!/bin/bash
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
hibernate
#!/bin/bash
dbus-send --system --print-reply --dest="org.freedesktop.DeviceKit.Power" /org/freedesktop/DeviceKit/Power org.freedesktop.DeviceKit.Power.Hibernate
and suspend
#!/bin/bash
dbus-send --system --print-reply --dest="org.freedesktop.DeviceKit.Power" /org/freedesktop/DeviceKit/Power org.freedesktop.DeviceKit.Power.Suspend
Last edited by Army (2010-12-25 20:42:09) -
Hi,
I'm looking for a shutdown script for linux to put it in crontab and another for startup. Do you have any ?
Thanks.OK, you can cron following commands (assume that all Oracle related env variables are set. We are setting ORACLE_SID just to ensure that we will be working with the right instance):
59 7 * * * su - oracle -c "export ORACLE_SID=ORCL; echo 'startup' | sqlplus -s '/ as sysdba' >>/dev/null" 2>&1
31 16 * * * su - oracle -c "export ORACLE_SID=ORCL; echo 'shutdown immediate' | sqlplus -s '/ as sysdba' >>/dev/null" 2>&1 -
Shutdown script for Weblogic admin & managed servers
Greetings,
I am new to weblogic and am using it on a new box with OID. I am in the process of writing a shutdown script to shut down all processes on the box when it is restarted, I think this is better than just pulling the plug. I have learned about and turned on t3 protocols and used WLST to tore credentials in WebLogicKey.properties & WebLogicConfig.properties file so things are working properly. What I can't find is how to shut down the managed server using WLST and am also wondering if it is better to invoke the stopManagedWebLogic.sh and the stopWebLogic.sh scripts form the shell or from the WLST tool, if indeed that is possible. If soemone has such scripts they would be willing to share that would be much appreciated.
Thank you.
Bill Wagman"One question, Rene, I see in your scripts you are storing username/password combinations.
I have used the storeUserConfig () command to create a WebLogicConfig.properties file and a WebLogicKey.properties file to avoid that issue.
Is there a reason you have not done this?"
No, what you did with the storeUserConfig, to prevent needing to store the unencrypted username
and password in your WLST scripts is good. One thing to note is that the key files are extremely sensitive
in that they allow any user to use the configuration file to authenticate as the user stored in the configuration
file. You should store the key files in a secure location so that only the authorized users have access to them (this
is also what you do with scripts that have unencrypted username and password in them). You probably have
an environment (operating system) in which only authorized users can reach the sensitive data. -
Shutdown script for Weblogic?
Hi,
I am looking for weblogic shutdown script?
Can anybody point me to the script if one is available.
Thanks in advance
Subba Reddyjust use the admnin utility from a shell and bat/cmd file. here's the
command:
java weblogic.Admin <url> SHUTDOWN system <password>
you may get the usage by just typing:
java weblogic.Admin
jason
Original Message <<<<<<<<<<<<<<<<<<On 3/10/00, 9:42:47 PM, subba reddy <[email protected]> wrote
regarding shutdown script for Weblogic?:
Hi,
I am looking for weblogic shutdown script?
Can anybody point me to the script if one is available.
Thanks in advance
Subba Reddy -
Powershell shutdown script issues
Hi Scripting Guys!
I'm working on a project to optimize school computers in my region(mainly boot/startup time). As all the students are local administrators it often results in them installing various programs, programs that more often than not, is set as a start-up program,
which obviously effects the start time.
So i decided to make a powershell script to go in and edit the registry for startup programs, with the intent of making it a shutdown script to be applied through a group policy.
But the script wont run.
Trying to run it manually works fine.
I've set execution policy to both all signed and remotesigned/unrestricted(i have signed the script though)
I've disabled the UAC as it gave me some issues during testing
I am a powershell rookie though so i'm sure i've missed some obvious mistake, either in the script or settings so i'm hoping you can assist me or point me in the right direction.
The script looks something like this:
Remove-Item -Path hklm:\Software\Microsoft\Windows\CurrentVersion\Run
New-Item -Path hklm:\Software\Microsoft\Windows\CurrentVersion\Run\ -ItemType Key
New-ItemProperty -Path hklm:\Software\Microsoft\Windows\CurrentVersion\Run\ -Value '"C:\Program Files\path to some driver.exe" -PropertyType String -Name "name of some driver"
bonus info:
i'm testing in a virtual inviroment using a Win2008r2 Domain controller with Win7 clients
From the clients, using rsop.msc, i can see the script, and the path, I can also see the attempt to start the script in eventviewer and it even says its finished about 2 seconds later. (rsop shows no last execution time)
Kind regards
Powershell rookieHi
The purpose of the script is not to install any of the drivers but rather starting them up(or something like that) like start only essential drivers like the anti-virus software and mousepad drivers for laptops. So basically the script is supposed to delete
the run folder in the registry database and then recreate it with only selected drivers.
I hope i'm making sense?
Regarding disabling all of first line security on my entire domain i'm not sure i follow? how will a shutdown script that edit the startup registry on my domain computers disable all that?
Thanks -
Using a shutdown script to save files to local sever
Hello,
I am writing a shutdown script which runs when the use shuts their computer down. The goal is to back up some user files to a local sever. I am wondering if the shutdown will be delayed until the file is uploaded to the server. The file is approx 1 - 2 gb
in size which would take a few minutes to send over to the server.
I have used gpedit.msc and linked the batch file I wish to run.
However, I have a few questions regarding this. Does windows wait for the batch file to finish executing before shutting down? If not,
is there a way to delay the shutdown long enough for the file to send?
For dev purposes I have experimented using a log off script (faster than constantly shutting off/turning on), however windows does not seem to want to wait and logs off before the btach file is finished executing. In the test batch script, I used the pause
command to test if it would wait for me to finish executing the file before it logged off, but it seems that it does not want to wait and just goes ahead and logs off before it is done.
The only work around I can think of is using a batch file which saves the files then turn off the computer
instead of a script being run at shutdown - this might be not a practical solution since I have to integrate this into several workstation computers. Also, some employees may forget to use the file to shut down. I am also not sure how keen my boss
would be for me to change the entire way everyone shuts down their computer (by running my batch file instead of the usual start->shutdown). If this is the only way to go about it I will discuss with him what needs to be done however I much prefer there
to be a script that automatically runs when they shut their computers off.
To wrap it up:
Using a shut down script, how do I delay the shutdown long enough for files to be saved to a local server? Will windows automatically wait for the batch script to finish executing before turning off?
Kind regards,
- StriderHello Strider,
It seems that you issue is related with windows client, I suggest that you could post it to:
https://social.technet.microsoft.com/Forums/windows/en-US/home?category=w7itpro%2Cw8itpro%2Cwindowsvistaitpro%2Cwindowsxpitpro%2Cwindowsintune
The current forum you post to is used to discuss general issues about developing applications for Windows.
Thanks for your understanding.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Installing application in shutdown script does not work
Hello,
I'm trying to organise the deployment of office 2013. I want to give users the choice between installation during startup and installation during shutdown of their computer.
Installation during startup works fine: installation starts and the user can use their computer and wait for the installation to finish in the background.
Installation initiated from a console window works fine as well.
However, installation using a shutdown script doesn't work as the installation command returns immediatly, the script ends and the computer shuts down.
I have changed the gpo script timeout setting.
In the powershell script, I execute the installation using "start-process" with the option "-wait". It seems like this command returns immediatly and the setup is never executed as it does not start logging the installation progress to
a local log file.
The shutdown script runs fine and it also logs its progress to a logfile on a network share so I'm sure the script actually runs and it has network access as well.
Any clues as to why the installation might fail during a shutdown script and work fine in other situations? Thanks!
I'm not sure if this is a gpo or an office 2013 deployment question. I'm thinking the environment during execution of a shutdown script might be different so that's why I'm asking my question here.Hi,
Based on your description, we can also try asking for suggestions in the scripting forum to see if they can provide a better solution.
The Official Scripting Guys Forum
http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
TechNet Subscriber Support
If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.
Best regards,
Frank Shen
Maybe you are looking for
-
ITunes will not fully install, it says i need bonjour permission (windows 7 64 bit)
I recently got my new desktop computer. It is an hp pavilion with Windows 7 64 bit operating system. I began adding on the programs i wanted on my computer after starting it up a few days ago and found that everytime i try to download iTunes (64 bit)
-
I would like to convert a jpeg pic I downloaded to IMAC to pdf so I can send it someone
-
Standard funtion module to fetch IDOC in xml format
Hi Experts I am not from ABAP background, am working in SAP PI. I have a queay regarding standard function modules in ABAP. I am wrote a java code to fetch IDOC by making a call to the ABAP standard functions. (passing an idoc number and fetching the
-
Interal Order not flowing to Accounting doc from MM
Hi Gurus, Need help on one of the issues with FI-MM integration. 1. We have created a MM movement type and posting is enabled to Cost center and Internal order with the movement type. 2. Cost center is automatically derived from OKB9, whereas Interna
-
I have an Apple desktop with OS X Lion. I was able to save my photos from my old Windows machine, and they are now in iPhoto. Will I be able to move those photos from iPhoto to Photoshop Elements Editor (which I am ordering from the Apple App store