在这里插入图片描述

imx6UL 开发板 设置程序自启动

第一步,创建开启脚本 apprun ,目录:touch /etc/init.d/apprun

#!/bin/sh
#
# start/stop app daemon.

### BEGIN INIT INFO
# Provides:          app
# Required-Start:    $network
# Required-Stop:     $network
# Default-Start:     S 2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: app daemon
# Description:       app is a daemon used to enable NFC features
### END INIT INFO

chmod 755 /home/root/ftp/app

#设置app 所在目录
DAEMON=/home/root/ftp/app   
PIDFILE=/var/run/app.pid
DESC="Linux app daemon for firets"

if [ -f /etc/default/app ] ; then
        . /etc/default/app
fi

set -e

do_start() {
       $DAEMON > /tmp/app.log 2>&1 &
}

do_stop() {
        start-stop-daemon --stop --name app --quiet
}

case "$1" in
  start)
        echo "Starting $DESC"
        do_start
        ;;
  stop)
        echo "Stopping $DESC"
        do_stop
        ;;
  restart|force-reload)
        echo "Restarting $DESC"
        do_stop
        sleep 1
        do_start
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0

第二步:查看当前运行级别:sudo runlevel ,比如 N 5 就是5级别。 建立软链接:

ln -s /etc/init.d/apprun /etc/rc5.d/S50appgo

在这里插入图片描述

C语言 状态机 条件执行语句

        /* ... */
        switch ( menu() )             // 根据menu()的结果跳转
        {
        case 'a':
        case 'A': action1();               // 执行动作1
                    break;           // 不执行任何其他动作
        case 'b':
        case 'B': action2();       // 执行动作2
                    break;           // 不执行默认的动作
        default:  putchar( 'a' ); // 如果没有识别到任何命令,输出一个警告信息
        }

Ubuntu下挂载FTP到本地

在Ubuntu系统中,需要将FTP挂载到本地以方便对FTP服务器上的文件进行操作。

实现起来非常简单,利用CurlFtpFS来实现。具体过程包括以下两步:

第一步,安装CurlFtpFS:

sudo apt-get install curlftpfs

第二步,创建目录,将FTP挂载到该目录:

mkdir ftp
 
curlftpfs ftp://root:123456@192.168.8.200 ftp/

延伸资料

挂载FTP服务器


curlftpfs -o codepage=utf8 ftp://username:password@192.168.192.168 /ftp

curlftpfs -o rw,allow_other ftp://centos:cloud4c@192.168.17.195 /home/centos/ftp

curlftpfs -o rw,allow_other ftp://192.168.17.195 /home/centos/ftp

5. 
开机自动挂载
echo "curlftpfs#username:password@192.168.1.111 /ftp fuse allow_other,uid=0,gid=0 0 0" >> /etc/fstab

6. 
卸载挂载

fusermount -u /ftp