玩客云刷armbian安装php环境_玩客云刷机为armbian后,挂载SD卡到www目录的脚本

摘要:

这个脚本是我买了一个刷好armbian系统的玩客云,然后自己安装好了宝塔,最后发现磁...

这个脚本是我买了一个刷好armbian系统的玩客云,然后自己安装好了宝塔,最后发现磁盘根本不够用,才6G多,于是又买了一张SD卡,因为SD卡终身保固,而且不占地方。

后来参照宝塔官网自己写了一个脚本把SD卡挂载到WWW目录。

对于那些没有安装任何东西的小伙伴,大家可以执行下面的脚本:echo -e ""

echo -e "格式化SD卡..."

echo -e ""

sleep 2

mkfs.ext4 /dev/mmcblk0p1

echo -e ""

echo -e "挂载SD卡..."

echo -e ""

sleep 2

mount /dev/mmcblk0p1 /www

echo "/dev/mmcblk0p1    /www    ext4    defaults    0 0" >> /etc/fstab

echo -e ""

echo -e "处理完成"

echo -e ""

注意:/www为需要挂载的目录

对于安装了宝塔并且还有一点数据的朋友,可以使用下面的脚本:#!/bin/bash

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin

export PATH

LANG=en_US.UTF-8

stop_service(){

/etc/init.d/bt stop

if [ -f "/etc/init.d/nginx" ]; then

/etc/init.d/nginx stop > /dev/null 2>&1

fi

if [ -f "/etc/init.d/httpd" ]; then

/etc/init.d/httpd stop > /dev/null 2>&1

fi

if [ -f "/etc/init.d/mysqld" ]; then

/etc/init.d/mysqld stop > /dev/null 2>&1

fi

if [ -f "/etc/init.d/pure-ftpd" ]; then

/etc/init.d/pure-ftpd stop > /dev/null 2>&1

fi

if [ -f "/etc/init.d/tomcat" ]; then

/etc/init.d/tomcat stop > /dev/null 2>&1

fi

if [ -f "/etc/init.d/redis" ]; then

/etc/init.d/redis stop > /dev/null 2>&1

fi

if [ -f "/etc/init.d/memcached" ]; then

/etc/init.d/memcached stop > /dev/null 2>&1

fi

if [ -f "/www/server/panel/data/502Task.pl" ]; then

rm -f /www/server/panel/data/502Task.pl

if [ -f "/etc/init.d/php-fpm-52" ]; then

/etc/init.d/php-fpm-52 stop > /dev/null 2>&1

fi

if [ -f "/etc/init.d/php-fpm-53" ]; then

/etc/init.d/php-fpm-53 stop > /dev/null 2>&1

fi

if [ -f "/etc/init.d/php-fpm-54" ]; then

/etc/init.d/php-fpm-54 stop > /dev/null 2>&1

fi

if [ -f "/etc/init.d/php-fpm-55" ]; then

/etc/init.d/php-fpm-55 stop > /dev/null 2>&1

fi

if [ -f "/etc/init.d/php-fpm-56" ]; then

/etc/init.d/php-fpm-56 stop > /dev/null 2>&1

fi

if [ -f "/etc/init.d/php-fpm-70" ]; then

/etc/init.d/php-fpm-70 stop > /dev/null 2>&1

fi

if [ -f "/etc/init.d/php-fpm-71" ]; then

/etc/init.d/php-fpm-71 stop > /dev/null 2>&1

fi

fi

}

start_service()

{

/etc/init.d/bt start

if [ -f "/etc/init.d/nginx" ]; then

/etc/init.d/nginx start > /dev/null 2>&1

fi

if [ -f "/etc/init.d/httpd" ]; then

/etc/init.d/httpd start > /dev/null 2>&1

fi

if [ -f "/etc/init.d/mysqld" ]; then

/etc/init.d/mysqld start > /dev/null 2>&1

fi

if [ -f "/etc/init.d/pure-ftpd" ]; then

/etc/init.d/pure-ftpd start > /dev/null 2>&1

fi

if [ -f "/etc/init.d/tomcat" ]; then

/etc/init.d/tomcat start > /dev/null 2>&1

fi

if [ -f "/etc/init.d/redis" ]; then

/etc/init.d/redis start > /dev/null 2>&1

fi

if [ -f "/etc/init.d/memcached" ]; then

/etc/init.d/memcached start > /dev/null 2>&1

fi

if [ -f "/etc/init.d/php-fpm-52" ]; then

/etc/init.d/php-fpm-52 start > /dev/null 2>&1

fi

if [ -f "/etc/init.d/php-fpm-53" ]; then

/etc/init.d/php-fpm-53 start > /dev/null 2>&1

fi

if [ -f "/etc/init.d/php-fpm-54" ]; then

/etc/init.d/php-fpm-54 start > /dev/null 2>&1

fi

if [ -f "/etc/init.d/php-fpm-55" ]; then

/etc/init.d/php-fpm-55 start > /dev/null 2>&1

fi

if [ -f "/etc/init.d/php-fpm-56" ]; then

/etc/init.d/php-fpm-56 start > /dev/null 2>&1

fi

if [ -f "/etc/init.d/php-fpm-70" ]; then

/etc/init.d/php-fpm-70 start > /dev/null 2>&1

fi

if [ -f "/etc/init.d/php-fpm-71" ]; then

/etc/init.d/php-fpm-71 start > /dev/null 2>&1

fi

if [ -f "/etc/init.d/php-fpm-72" ]; then

/etc/init.d/php-fpm-71 start > /dev/null 2>&1

fi

if [ -f "/etc/init.d/php-fpm-73" ]; then

/etc/init.d/php-fpm-71 start > /dev/null 2>&1

fi

echo "True" > /www/server/panel/data/502Task.pl

}

echo -e ""

echo -e "停止宝塔服务"

echo -e ""

sleep 3

stop_service

echo -e ""

echo -e "数据备份..."

echo -e ""

sleep 2

mv /www /bt-backup

echo -e ""

echo -e "格式化SD卡..."

echo -e ""

sleep 2

mkfs.ext4 /dev/mmcblk0p1

echo -e ""

echo -e "挂载SD卡..."

echo -e ""

sleep 2

mkdir /www

mount /dev/mmcblk0p1 /www

echo "/dev/mmcblk0p1    /www    ext4    defaults    0 0" >> /etc/fstab

echo -e ""

echo -e "数据还原中..."

echo -e ""

cp -r -p -a /bt-backup/* /www

echo -e ""

echo -e "处理完成"

echo -e ""

echo -e "启动宝塔服务"

echo -e ""

start_service

rm -rf /bt-backup

注意:上面这个脚本使用的时候会自动备份宝塔数据,但是玩客云的剩余储存小于www目录的使用量时,就需要自己手动备份,清空一定量的空间,必须保证玩客云的剩余储存大于www目录的使用量。

这样看起来是不是空间大了好多了

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值