VirtualBox

source: vbox/trunk/src/VBox/Installer/solaris/smf-vboxballoonctrl.sh@ 42000

Last change on this file since 42000 was 36748, checked in by vboxsync, 14 years ago

Installer/solaris: change service log rotation intervals from weekly to daily

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1#!/sbin/sh
2# $Id: smf-vboxballoonctrl.sh 36748 2011-04-20 11:24:54Z vboxsync $
3
4# Copyright (C) 2008-2011 Oracle Corporation
5#
6# This file is part of VirtualBox Open Source Edition (OSE), as
7# available from http://www.virtualbox.org. This file is free software;
8# you can redistribute it and/or modify it under the terms of the GNU
9# General Public License (GPL) as published by the Free Software
10# Foundation, in version 2 as it comes in the "COPYING" file of the
11# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
12# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
13#
14
15#
16# smf-vboxballoonctrl method
17#
18# Argument is the method name (start, stop, ...)
19
20. /lib/svc/share/smf_include.sh
21
22VW_OPT="$1"
23VW_EXIT=0
24
25case $VW_OPT in
26 start)
27 if [ ! -x /opt/VirtualBox/VBoxBalloonCtrl ]; then
28 echo "ERROR: /opt/VirtualBox/VBoxBalloonCtrl does not exist."
29 return $SMF_EXIT_ERR_CONFIG
30 fi
31
32 if [ ! -f /opt/VirtualBox/VBoxBalloonCtrl ]; then
33 echo "ERROR: /opt/VirtualBox/VBoxBalloonCtrl does not exist."
34 return $SMF_EXIT_ERR_CONFIG
35 fi
36
37 # Get svc configuration
38 VW_USER=`/usr/bin/svcprop -p config/user $SMF_FMRI 2>/dev/null`
39 [ $? != 0 ] && VW_USER=
40 VW_INTERVAL=`/usr/bin/svcprop -p config/interval $SMF_FMRI 2>/dev/null`
41 [ $? != 0 ] && VW_INTERVAL=
42 VW_INCREMENT=`/usr/bin/svcprop -p config/increment $SMF_FMRI 2>/dev/null`
43 [ $? != 0 ] && VW_INCREMENT=
44 VW_DECREMENT=`/usr/bin/svcprop -p config/decrement $SMF_FMRI 2>/dev/null`
45 [ $? != 0 ] && VW_DECREMENT=
46 VW_LOWERLIMIT=`/usr/bin/svcprop -p config/lowerlimit $SMF_FMRI 2>/dev/null`
47 [ $? != 0 ] && VW_LOWERLIMIT=
48 VW_ROTATE=`/usr/bin/svcprop -p config/logrotate $SMF_FMRI 2>/dev/null`
49 [ $? != 0 ] && VW_ROTATE=
50 VW_LOGSIZE=`/usr/bin/svcprop -p config/logsize $SMF_FMRI 2>/dev/null`
51 [ $? != 0 ] && VW_LOGSIZE=
52 VW_LOGINTERVAL=`/usr/bin/svcprop -p config/loginterval $SMF_FMRI 2>/dev/null`
53 [ $? != 0 ] && VW_LOGINTERVAL=
54
55 # Provide sensible defaults
56 [ -z "$VW_USER" ] && VW_USER=root
57 [ -z "$VW_INTERVAL" ] && VW_INTERVAL=10000
58 [ -z "$VW_INCREMENT" ] && VW_INCREMENT=256
59 [ -z "$VW_DECREMENT" ] && VW_DECREMENT=128
60 [ -z "$VW_LOWERLIMIT" ] && VW_LOWERLIMIT=64
61 [ -z "$VW_ROTATE" ] && VW_ROTATE=10
62 [ -z "$VW_LOGSIZE" ] && VW_LOGSIZE=104857600
63 [ -z "$VW_LOGINTERVAL" ] && VW_LOGINTERVAL=86400
64 exec su - "$VW_USER" -c "/opt/VirtualBox/VBoxBalloonCtrl --background --interval \"$VW_INTERVAL\" --balloon-inc \"$VW_INCREMENT\" --balloon-dec \"$VW_DECREMENT\" --balloon-lower-limit \"$VW_LOWERLIMIT\" --logrotate \"$VW_ROTATE\" --logsize \"$VW_LOGSIZE\" --loginterval \"$VW_LOGINTERVAL\""
65
66 VW_EXIT=$?
67 if [ $VW_EXIT != 0 ]; then
68 echo "VBoxBalloonCtrl failed with $VW_EXIT."
69 VW_EXIT=1
70 fi
71 ;;
72 stop)
73 # Kill service contract
74 smf_kill_contract $2 TERM 1
75 ;;
76 *)
77 VW_EXIT=$SMF_EXIT_ERR_CONFIG
78 ;;
79esac
80
81exit $VW_EXIT
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette