Skip to content

Instantly share code, notes, and snippets.

@oldcai
Last active September 14, 2018 08:47
Show Gist options
  • Save oldcai/b816e22ee2ad360b4793668636a9cf3e to your computer and use it in GitHub Desktop.
Save oldcai/b816e22ee2ad360b4793668636a9cf3e to your computer and use it in GitHub Desktop.
KoolShare Merlin boot start /jffs/scripts/ files
#!/bin/sh
/jffs/scripts/xunlei stop
/jffs/scripts/swap stop
/jffs/scripts/remount start
/jffs/scripts/swap start
/jffs/scripts/xunlei start
#!/bin/sh
DISK1=/tmp/mnt/sda1
DISK2=/tmp/mnt/sda2
MAX_DISKS=2
# Logging of the script start
/usr/bin/logger -t START_$(basename $0) "started [$@]"
SCRLOG=/tmp/$(basename $0).log
touch $SCRLOG
NOW=$(date +"%Y-%m-%d %H:%M:%S")
echo $NOW "START_$(basename $0) started [$@]" >> $SCRLOG
#
# Executing the script commands
#
i=1
while [ $i -lt $((MAX_DISKS+1)) ]
do
eval "disk=\$DISK$i"
if ! mount | grep $disk > /dev/null; then
echo "Data disk not mounted yet! Script: $0" >> $SCRLOG
exit $?
fi
echo "${disk} mounted" >> $SCRLOG
true $(( i++ ))
done
sh /jffs/scripts/all-mount >> $SCRLOG
# Logging the finishing of the script
NOW=$(date +"%Y-%m-%d %H:%M:%S")
if [ "$?" -ne 0 ]
then
echo $NOW "Error in script execution! Script: $0" >> $SCRLOG
else
echo $NOW "Script execution OK. Script: $0" >> $SCRLOG
fi
/usr/bin/logger -t STOP_$(basename $0) "return code $?"
exit $?
#!/bin/sh
source /koolshare/scripts/base.sh
start() {
mkdir -p /tmp/mnt/sda1/downloads/TDDOWNLOAD/
umount /tmp/mnt/sda1/TDDOWNLOAD/
mkdir -p /tmp/mnt/sda1/TDDOWNLOAD/
mount -r --rbind /tmp/mnt/sda1/downloads/TDDOWNLOAD/ /tmp/mnt/sda1/TDDOWNLOAD/
umount /tmp/mnt/sda2/TDDOWNLOAD/
mkdir -p /tmp/mnt/sda2/TDDOWNLOAD/
mount -r --rbind /tmp/mnt/sda1/downloads/TDDOWNLOAD/ /tmp/mnt/sda2/TDDOWNLOAD/
}
case $ACTION in
start)
start
;;
esac
#!/bin/sh
APPS_DEV=`/bin/mount | grep -E 'mnt' | sed -n 1p | cut -d" " -f1`
APPS_MOUNTED_PATH=`/bin/mount | grep -E 'mnt' | sed -n 1p | cut -d" " -f3`
APPS_INSTALL_FOLDER=swap
APPS_INSTALL_PATH=$APPS_MOUNTED_PATH/$APPS_INSTALL_FOLDER
SWAP_FILE=`nvram get apps_swap_file`
SWAP_SIZE=128000
case "$1" in
start)
mem_size=`free |sed '1,3d' |awk '{print $4}'`
pool_size=`df $APPS_DEV |sed '1d' |awk '{print $4}'`
if [ $pool_size -gt $SWAP_SIZE ]; then
if [ -e "$APPS_INSTALL_PATH/$SWAP_FILE" ]; then
swapoff $APPS_INSTALL_PATH/$SWAP_FILE
rm -rf $APPS_INSTALL_PATH/$SWAP_FILE
fi
mkdir -p $APPS_INSTALL_PATH
swap_count=`expr $SWAP_SIZE / 1000 - 1`
echo "dd if=/dev/zero of=$APPS_INSTALL_PATH/$SWAP_FILE bs=1M count=$swap_count"
dd if=/dev/zero of=$APPS_INSTALL_PATH/$SWAP_FILE bs=1M count=$swap_count
echo "mkswap $APPS_INSTALL_PATH/$SWAP_FILE"
mkswap $APPS_INSTALL_PATH/$SWAP_FILE
echo "swapon $APPS_INSTALL_PATH/$SWAP_FILE"
swapon $APPS_INSTALL_PATH/$SWAP_FILE
echo "......................................................................."
free
echo "......................................................................."
echo ""
else
echo "No enough partition size!"
exit 1
fi
;;
stop)
if [ -e "$APPS_INSTALL_PATH/$SWAP_FILE" ]; then
swapoff $APPS_INSTALL_PATH/$SWAP_FILE
rm -rf $APPS_INSTALL_PATH/$SWAP_FILE
echo "......................................................................."
free
echo "......................................................................."
echo ""
fi
;;
*)
exit 1
;;
esac
#!/bin/sh
source /koolshare/scripts/base.sh
eval `dbus export thunder`
thunderPath=/koolshare/thunder
start() {
$thunderPath/portal &
}
stop() {
$thunderPath/portal -s
sleep 2
}
case $ACTION in
start)
start
;;
stop)
stop
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment