sudo apt-get install aria2 apache2
sudo visudo
www-data ALL=(ALL) NOPASSWD: ALL
mkdir ~/.aria2
touch ~/.aria2/aria2.session
nano ~/.aria2/aria2.conf
dir=/home/xbian/Download #下载默认的目录
disable-ipv6=true
enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true
#rpc-listen-port=6800
continue=true
input-file=/home/xbian/.aria2/aria2.session #刚才touch命令的那个文件,路径要绝对路径
save-session=/home/xbian/.aria2/aria2.session #同上,这个文件的作用是保存你的下载列表,不保存的话重启后所有下载都木有了
max-concurrent-downloads=3
sudo nano /etc/init.d/aria2c
#!/bin/sh
### BEGIN INIT INFO
# Provides: aria2
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Aria2 Downloader
### END INIT INFO
case "$1" in
start)
echo -n "Starting aria2c"
sudo -u xbian aria2c --conf-path=/home/xbian/.aria2/aria2.conf -D
#sudo -u后面的是你正在使用的用户名,因为我用的XBian,用debian的是pi(没改用户的话)
;;
stop)
echo -n "Shutting down aria2c "
killall aria2c
;;
restart)
killall aria2c
sudo -u xbian aria2c --conf-path=/home/xbian/.aria2/aria2.conf -D
#同上面的一样,根据自己的用户名改xbian。
;;
esac
exit
sudo chmod 755 /etc/init.d/aria2c
sudo service aria2c start
sudo update-rc.d aria2c defaults
cd /var/www
git clone http://github.com/wzhy90/yaaw
#!/bin/sh
### BEGIN INIT INFO
# Provides: aria2
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Aria2 Downloader
### END INIT INFO
NAME=aria2c
USER=wzhy90
ARIA2C=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
CONF=/home/$USER/.aria2/aria2.conf
ARGS="--conf-path=${CONF}"
test -f $ARIA2C || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting aria2c."
if [ -e "$PIDFILE" ]; then
log_warning_msg "aria2c is already running."
else
start-stop-daemon -S -q -b -m -p $PIDFILE -c $USER -a $ARIA2C -- $ARGS
log_end_msg $?
fi
;;
stop)
log_daemon_msg "Stopping aria2c."
if [ -e "$PIDFILE" ]; then
start-stop-daemon -K -q -p $PIDFILE
rm $PIDFILE
log_end_msg $?
else
log_warning_msg "aria2c is not running."
fi
;;
restart|reload|force-reload)
log_daemon_msg "Restarting aria2c."
if [ -e "$PIDFILE" ]; then
start-stop-daemon -K -R 5 -q -p $PIDFILE
start-stop-daemon -S -q -b -m -p $PIDFILE -c $USER -a $ARIA2C -- $ARGS
log_end_msg $?
else
log_warning_msg "aria2c is not running."
fi
;;
status)
status_of_proc -p $PIDFILE $ARIA2C aria2c && exit 0 || exit $?
;;
*)
log_action_msg "Usage: /etc/init.d/aria2c {start|stop|restart|reload|force-reload|status}"
exit 2
;;
esac
exit 0
小黑屋|手机版|Archiver|万博网页版登陆页派论坛 ( 粤ICP备15075382号-1 )
GMT+8, 2024-11-1 10:36 , Processed in 1.125000 second(s), 35 queries , Gzip On.
Powered by Shumeipai.net! X3.2
© 2001-2015 万博网页版登陆页派论坛,安全联盟