Commit a469c989 authored by Jondy Zhao's avatar Jondy Zhao

Add /usr/local/bin to path in the crontab file

Remove init-slapos-node.sh
parent b74eb518
#! /bin/bash
#
# It used to initialzie slapos node when the computer startup:
#
# 1. Start re6stnet,
#
# 2. Run slapformat to synchornize information with master
#
# 3. Start slapproxy
#
# 4.
#
export PATH=/usr/local/bin:/usr/bin:$PATH
ifname=re6stnet-lo
# Run re6stnet
echo "Start re6stnet ..."
(cd /etc/re6stnet; re6stnet @re6stnet.conf --ovpnlog -I $ifname -i $ifname &)
echo "Start re6stent in the background OK."
echo "Waiting re6stent network work ..."
while true ; do
ping6 slap.vifib.com && break
done
echo "re6stnet network OK."
# Run slapformat
echo "Initializing SlapOS Node ..."
/opt/slapos/bin/slapos node format -cv --now
if (( $? )) ; then
echo "Initialize SlapOS Node failed."
else
echo "Initialize SlapOS Node OK."
fi
# Run slapproxy
# /opt/slapos/bin/slapproxy || echo "Start slapproxy failed."
exit 0
......@@ -58,12 +58,10 @@ Source: "opt\git\slapos.package\windows\openvpn\src\openvpn\.libs\openvpn.exe";
Source: "opt\openvpn\bin\*"; DestDir: "{app}\cygwin\usr\local\bin";
Source: "opt\openvpn\driver\*"; DestDir: "{app}\cygwin\etc\slapos\driver";
Source: "opt\git\slapos.package\windows\scripts\init-slapos-node.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\slapos-node.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\post-install.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\build-slapos.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\slapos-configure.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\slapos-node-runner.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\slap-runner.html"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\pre-uninstall.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
......
......@@ -267,18 +267,6 @@ else
fi
check_service_state syslog-ng
echo Checking cron job ...
ps -ef | grep -q "/usr/sbin/cron"
if (( $? )) ; then
echo Starting cron job ...
/usr/sbin/cron &
(( $? )) && show_error_exit "Failed to run cron-config"
disown -h
echo The cron job started.
else
echo The cron job is running.
fi
#-------------------------------------------------
# Configure slapos network
#-------------------------------------------------
......@@ -593,7 +581,7 @@ if (( $? )) ; then
if (( $? )) ; then
[[ -d /var/log/re6stnet ]] || mkdir -p /var/log/re6stnet
echo "Install slapos-re6stnet service ..."
cygrunsrv -I $service_name -c /etc/re6stnet -p $(which re6stnet) -a "@re6stnet.conf" -u Administrator|| \
cygrunsrv -I $service_name -c /etc/re6stnet -p $(which re6stnet) -a "@re6stnet.conf" || \
show_error_exit "Failed to install $service_name service."
echo "Cygwin $service_name service installed."
# echo "Waiting re6stent network work ..."
......@@ -694,8 +682,8 @@ fi
crontab_file=/var/cron/tabs/$(whoami)
if [[ ! -f $crontab_file ]] ; then
cat <<EOF > $crontab_file
SHELL=/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin:/bin
SHELL=/bin/bash
PATH=/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
MAILTO=""
# Run "Installation/Destruction of Software Releases" and "Deploy/Start/Stop Partitions" once per minute
......@@ -715,6 +703,19 @@ EOF
echo Cron file $crontab_file created.
fi
echo Checking cron job ...
ps -ef | grep -q "/usr/sbin/cron"
if (( $? )) ; then
echo Starting cron job ...
/usr/sbin/cron &
(( $? )) && show_error_exit "Failed to run cron-config"
disown -h
echo The cron job started.
else
echo The cron job is running.
fi
#-------------------------------------------------
# Add slapos-configure to windows startup item
#-------------------------------------------------
......
#! /bin/bash
#
export PATH=/usr/local/bin:/usr/bin:/bin:$PATH
current_path=$(cygpath -a $(dirname $0))
if [[ ! -f $current_path/node-runner.vbs ]] ; then
echo Installing slap-runner ...
$current_path/slapos-configure runner || (echo Failed to create instance of slap-runner ; exit 1)
echo Install slap-runner OK.
fi
# cat <<EOF > $current_path/node-runner.vbs
# Set oShell = CreateObject("WScript.Shell")
# oShell.OpenBrowser("http://[2001:67c:1254:45::c5d5]:50000")
# EOF
if [[ -f $current_path/node-runner.vbs ]] ; then
echo Starting slap-runner ...
cyg_cscript $current_path/node-runner.vbs || (echo Failed to start slap-runner ; exit 1)
echo Start slap-runner OK.
fi
cat <<EOF > slap-runner.html
d>
<script LANGUAGE="JavaScript">
<!--
function openwin() {
location.reload("url")
}
//-->
</script>
</head>
<body onload="openwin()">
</body>
</html>
EOF
......@@ -123,7 +123,7 @@ if (( $? )) ; then
if (( $? )) ; then
[[ -d /var/log/re6stnet ]] || mkdir -p /var/log/re6stnet
echo "Install slapos-re6stnet service ..."
cygrunsrv -I $service_name -c /etc/re6stnet -p $(which re6stnet) -a "@re6stnet.conf" -u Administrator|| \
cygrunsrv -I $service_name -c /etc/re6stnet -p $(which re6stnet) -a "@re6stnet.conf" || \
show_error_exit "Failed to install $service_name service."
echo "Cygwin $service_name service installed."
# echo "Waiting re6stent network work ..."
......
......@@ -52,12 +52,10 @@ Source: "opt\git\slapos.package\windows\openvpn\src\openvpn\.libs\openvpn.exe";
Source: "opt\openvpn\bin\*"; DestDir: "{app}\cygwin\usr\local\bin";
Source: "opt\openvpn\driver\*"; DestDir: "{app}\cygwin\etc\slapos\driver";
Source: "opt\git\slapos.package\windows\scripts\init-slapos-node.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\slapos-node.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\post-install.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\build-slapos.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\slapos-configure.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\slapos-node-runner.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\slap-runner.html"; DestDir: "{app}\cygwin\etc\slapos\scripts";
Source: "opt\git\slapos.package\windows\scripts\pre-uninstall.sh"; DestDir: "{app}\cygwin\etc\slapos\scripts";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment