一键安装scrapyd并配置好自启动

我的博客中提到过gerapy的使用,但是,安装gerapy之前是需要把scrapyd配置好的。我写了一个bash脚本一键安装scrapyd并配置好自启动服务。不足的是,需要手动更改scrapyd.conf里的bind ip address然后重新启动scrapyd。

脚本在我的github里: https://github.com/chenxuzhen/bash_install_scrapyd,也可以复制粘贴:

#/bin/bash

pip install scrapyd
cd $HOME
rmdir ~/scrapyd
mkdir ~/scrapyd
sudo rm /usr/lib/systemd/system/scrapyd.service
sudo touch /usr/lib/systemd/system/scrapyd.service
sudo chown $USER:$USER /usr/lib/systemd/system/scrapyd.service
sudo echo "
[Unit]
Description=Scrapyd service
After=network.target

[Service]
User=user
Group=group
WorkingDirectory=anydirectory
ExecStart=scrapyd

[Install]
WantedBy=multi-user.target " >> /usr/lib/systemd/system/scrapyd.service

sudo sed -i "s/User\=user/User\="$USER"/" /usr/lib/systemd/system/scrapyd.service
sudo sed -i "s/Group\=group/Group\="$USER"/" /usr/lib/systemd/system/scrapyd.service
sudo sed -i "s|=anydirectory|="$HOME"/scrapyd|" /usr/lib/systemd/system/scrapyd.service
scrapyd_bin=`echo $(whereis scrapyd) | cut -c 10-99`
echo "$scrapyd_bin"
sudo sed -i "s|=scrapyd|="$scrapyd_bin"|" /usr/lib/systemd/system/scrapyd.service

# nohup $(whereis scrapyd) >& /dev/null &
sudo systemctl enable scrapyd.service
sudo service scrapyd start
sudo service scrapyd status
echo "please change bind ip address in scrapyd.conf and reload scrapyd conf"

centos一键安装denyhosts

denyhosts手动安装比较繁琐,我自己安装过几次还需要经常查看History。这里放个非常方便的一键脚本吧,以前用Lnmp建过博客网站,lnmp包里就有这些工具,非常好用。这年头无聊的人太多了,说不准哪天你的服务器就被别人暴力破解了。

wget http://soft.vpser.net/lnmp/lnmp1.4beta.tar.gz && tar zxf lnmp1.4beta.tar.gz && cd lnmp1.4/tools/
工具箱内容:
backup.sh  check502.sh  cut_nginx_logs.sh  denyhosts_removeip.sh  denyhosts.sh  fail2ban.sh  remove_disable_function.sh  remove_open_basedir_restriction.sh  reset_mysql_root_password.sh