记录我的一些生活写照、无聊的牢骚、内心世界的活动 注册 | 登陆

Howto install a NewCS Server on Debian Linux

Howto install a NewCS Server on Debian Linux

Howto NewCS on debian based on "Howto: Building Debian Linux server with CCcam" written by CC_share (useful for N3 cards with hd-channels because hd channels from this cards won´t run on actual cccam so you should use mgcamd as newcs client)

This howto ´ll show the installation for Debian linux with newcs.
You should use it in combination with the "Howto: Building Debian Linux server with CCcam" written by CC_share with needed basic-installation tutorial for debian linux.
You can also combine this tutorial with his one to install a cccam server with
newcs as cardserver.
If you´ve installed your debian system on the CC_share way you should have all needed basics on place.
To use cccam and newcs together you should first install debian with cccam with the tutorial of CC_Share.
If you need only newcs on your system, use CC_share´s tutorial from the start to "Startup script for CCcam"
After that you should use the following commands via telnet.
For systems with complete "CC_share like" installation you ´ll need only the
following additional steps.
You can copy and paste the following commands in your putty console.
Code:

mkdir /emu/newcs
vim /emu/script/newcs

Now you must push "i" on your keyboard and insert the following
Code:


#!/bin/sh
CAMNAME="NewCS Server"
# end

# This method starts CCcam
start_cam ()
{
/emu/newcs/newcs.i686 &
sleep 2
}
# This method stops NewCS
stop_cam ()
{
pkill newcs.i686
}
case "$1" in
start)
echo "[SCRIPT] $1: $CAMNAME"
start_cam
;;
stop)
echo "[SCRIPT] $1: $CAMNAME"
stop_cam
;;
restart)
echo "Restaring $CAMNAME"
stop_cam
start_cam
;;
*)
"$0" stop
exit 1
;;
esac
exit 0

Save it by pushing "Esc" followed by "ZZ" on your Keyboard.
Next commands are
Code:


chmod 755 /emu/script/newcs
ln /emu/script/newcs /bin/newcs

Now you can simply start, stop or restart newcs in putty by typing
Code:

newcs start
newcs stop
newcs restart

Now use a FTP program to upload newcs.i686 and newcs.xml to /emu/newcs ,but dont forget to rename the newcs.xml.phoenix to newcs.xml before you upload it.
May be you have to edit your newcs.xml to change the "node" entry from
"<node>/dev/tts/0</node>" into "<node>/dev/ttyS0</node>" for com1 or
"<node>/dev/ttyS1</node>" for com2.

Making NewCS executable
Use putty again to give newcs.i686 execution rights

Code:

chmod 755 /emu/newcs/newcs.i686

Config update script
When you're running a big server, restoring connections can take some time when you change your config file. I like to do my config changes once a day. I use this script to backup the old config and put the new config in place. This is done at 3am so my peers don't notice it and they don't suffer from a freezing picture every time you make a change.

Code:


vim /emu/script/configupdate_newcs.sh

Now you must push "i" on your keyboard and insert the following
Code:


#!/bin/sh
#Script to process new config and backup old one.
SOURCE=/emu/newcs
TARGET=/etc
FILE=newcs.xml
BACKUPDIR=/var/backup
CONFIGOLD=newcs.old
if test -f $SOURCE/$FILE ; then
echo "New Config Present"
if test -d $BACKUPDIR ; then
if test -f $BACKUPDIR/$CONFIGOLD ; then
echo "Removing OLD config file from backup directory"
rm $BACKUPDIR/$CONFIGOLD
else
echo "No OLD config to remove."
fi

if test -f $BACKUPDIR/$FILE ; then
echo "Renaming Backup to old config"
cp $BACKUPDIR/$FILE $BACKUPDIR/$CONFIGOLD
rm $BACKUPDIR/$FILE
else
echo "No Backupfile present yet"
fi
if test -f $TARGET/$FILE ; then
echo "Copying Original config to Backup directory"
cp $TARGET/$FILE $BACKUPDIR
rm $TARGET/$FILE
else
echo "No Original Config File Present!?!?"
fi
else
echo "Backup directory does not exist."
echo "making new directory"
mkdir $BACKUPDIR
if test -f $TARGET/$FILE ; then
echo "Copying Original config to Backup directory"
cp $TARGET/$FILE $BACKUPDIR
else
echo "No Original Config File Present!?!?"
fi
fi
echo "Moving New config file to "$TARGET
cp $SOURCE/$FILE $TARGET
rm $SOURCE/$FILE
else
echo "No New Config present, Nothing to process"
fi
exit

Save it by pushing "Esc" followed by "ZZ" on your Keyboard.

Next commands are
Code:


chmod 755 /emu/script/configupdate_newcs.sh


To make sure the config update script will run at 3 am everynight, we can place it in crontab.

Code:


cd /etc
vim crontab

Now you must push "i" on your keyboard and insert the following
Code:


00 3 * * * root /emu/script/./configupdate_newcs.sh >>/emu/log/configupdate_newcs.log 2>&1

Save it by pushing "Esc" followed by "ZZ" on your Keyboard.

Add NewCS to the startup so it will start on the next reboot.
Code:


vim /etc/rc.local

Now you must push "i" on your keyboard and insert the following
Code:


/bin/newcs start &

Save it by pushing "Esc" followed by "ZZ" on your Keyboard.
Now you should reboot the server and check that NewCS and (or) CCcam is running.

« 上一篇 | 下一篇 »

发表评论

评论内容 (必填):