Home > OS >  In the init. D. script using chmod, file size becomes zero!!!!
In the init. D. script using chmod, file size becomes zero!!!!

Time:09-28

Linux kernel version: version 3.18.20

Problem description: in order to realize the application processes on the embedded development board boot automatically start, wrote a init. D script to execute applications, due to the application file download is the ADB tool to the development board, the default is no executable permissions, so in the init... d scripts use chmod to modify permissions;
Download file into the system to restart the development board, found that permission to change come over, but the size of the file to 0, also can not be properly carried out:

- rwxr-xr-x mto root root 0 1 Oct 14 08:23 yln_app



 

#!/bin/sh
#
# Copyright (C) 2016-2020 Quectel Wireless Co., Ltd.
# Quectel Wireless Proprietary and Confidential.
# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
#
# Description:
# init. D. script for Quectel QuecOpen application.
#
# Created by Stanely. YONG
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#

The set -e

# here the user can indicate the user app path
AppProgram=/home/root/yln_app

Case "$1" in
Start)
if ! [-f $AppProgram]
Then
Echo "# # # QuecOpen Application doesn 't exist # # #"
The exit 3
Fi

# change the file mode + x before the app start
Chmod 755 $AppProgram

Echo - n & gt;"> Starting QuecOpen application:
"
# start - stop - daemon - S - b - a $AppProgram

$AppProgram & amp;

Echo "done"
;;
Stop)
Echo - n "Stopping quectel daemon,"
Start - stop - daemon - K - n AppImageBinV01
Echo "done"
;;
Restart)
$0 stop
$0 start
;;
*)
Echo "Usage: QuecOpen_startapp {start | stop | restart}" & gt; & 2
The exit 1
;;
Esac

The exit 0

  • Related