Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
xargs: invalid option -- 'i'
BusyBox v1.22.1 (2014-07-03 15:30:22 CST) multi-call binary.
Usage: xargs [OPTIONS] [PROG ARGS]
Run PROG on every item given by stdin
-p Ask user whether to run each command
-r Don't run command if input is empty
-0 Input is separated by NUL characters
-t Print the command on stderr before execution
-e[STR] STR stops input processing
-n N Pass no more than N args to PROG
-s N Pass command line of no more than N bytes
-x Exit if size is exceeded
I was trying with this as well:
Code:
+ find /media/sdmmc/mmcblk0p1/RECORD/ -name *.mkv -mmin +1 -print0
mv: can't stat '/media/sdmmc/mmcblk0p1/RECORD/M-20240325_104804_0002/2024-03-25__11_08_15.mkv/{}': Path has non-directory component
mv: can't stat '/media/sdmmc/mmcblk0p1/RECORD/M-20240325_104804_0002/2024-03-25__11_08_15.mkv/EXPORTS': Path has non-directory component
mv: can't stat '/media/sdmmc/mmcblk0p1/RECORD/M-20240325_104804_0002/2024-03-25__11_08_15.mkv/2024-03-25__10_58_10.mkv': Path has non-directory component
Apparently you are trying to run this on busybox https://linux.die.net/man/1/busybox, a shell commonly found on various small devices - routers and such. It's lightweight, but its capabilities are very limited, its built-in xargs supports just want it printed and no more.
Im still struggling with that file syncronisation issue.
I got a script that is run by systemD.
If I run the script manually as root, its ok.
However when I start that script with systemD that red process line never gets executed. The files never move into that EXPORT folder.
Here is the script:
Code:
#!/bin/sh
set -x
MAC=$(ip a | grep ether | head -1 | awk '{print $2}' | sed 's/:/-/g')
CONFIG="/usr/bin/syncroniser.cfg"
KEY="/usr/bin/dropbear_rsa_host_key"
SRC="/media/sdmmc/mmcblk0p1/RECORD/"
EXPORTS="/media/sdmmc/mmcblk0p1/RECORD/EXPORTS/"
DST="$MAC"
FREQ=60
while true
do
if test -f "$CONFIG"; then
. "$CONFIG"
fi
mkdir -p "$EXPORTS"
find "$SRC" -name "*.mkv" -mmin +1 -exec sh -c 'mv -f "$@" '"$EXPORTS" sh {} +
rsync --remove-source-files --timeout=30 -avme "ssh -i $KEY -p $REMOTE_PORT" $EXPORTS $REMOTE_USER@$REMOTE_IP:$DST
sleep $FREQ
done
This is the systemD status:
Code:
systemctl status syncroniser
● syncroniser.service - Remote Syncroniser
Loaded: loaded (/etc/systemd/system/syncroniser.service; disabled)
Active: active (running) since Wed 2024-03-27 07:41:41 CET; 9s ago
Main PID: 5645 (sh)
CGroup: /system.slice/syncroniser.service
├─ 5645 /bin/sh /usr/bin/syncroniser
├─11079 find /media/sdmmc/mmcblk0p1/RECORD/ -name *.mkv -mmin +1 -exec sh -c mv -f "$@" /media/sdmmc/mmcblk0p1/RECORD/EXPORTS/ sh {} +
└─11218 n/a
#
#
# systemctl status syncroniser
● syncroniser.service - Remote Syncroniser
Loaded: loaded (/etc/systemd/system/syncroniser.service; disabled)
Active: active (running) since Wed 2024-03-27 07:41:41 CET; 20s ago
Main PID: 5645 (sh)
CGroup: /system.slice/syncroniser.service
├─ 5645 /bin/sh /usr/bin/syncroniser
├─17981 rsync --remove-source-files --timeout=30 -avme ssh -i /usr/bin/dropbear_rsa_host_key -p 2222 /media/sdmmc/mmcblk0p1/RECORD/EXPORTS/ encoder@1.2.3.4:encoder
└─17982 ssh -i /usr/bin/dropbear_rsa_host_key -p 2222 -l encoder -4 1.2.3.4 rsync --server -vlmosdtpre.iLgfxCIiu --timeout=30 --remove-source-files . encoder
#!/bin/sh
set -x
MAC=$(ip a | grep ether | head -1 | awk '{print $2}' | sed 's/:/-/g')
CONFIG="/usr/bin/syncroniser.cfg"
KEY="/usr/bin/dropbear_rsa_host_key"
SRC="/media/sdmmc/mmcblk0p1/RECORD/"
EXPORTS="/media/sdmmc/mmcblk0p1/RECORD/EXPORTS/"
DST="$MAC"
FREQ=60
while true
do
if test -f "$CONFIG"; then
. "$CONFIG"
fi
mkdir -p "$EXPORTS"
find $SRC -mmin +1 -type f -name *.mkv -exec mv "{}" $EXPORTS \;
rsync --remove-source-files --timeout=30 -avme "ssh -i $KEY -p $REMOTE_PORT" $EXPORTS $REMOTE_USER@$REMOTE_IP:$DST
sleep $FREQ
done
If I start it manually, it works like a charm. However if I start it with systemD, the "green find" line never happens, I suspect the red part at the end somehow have an impact on systemD
However if I start it with systemD, the "green find" line never happens, I suspect the red part at the end somehow have an impact on systemD
Forget that impact on systemd, do not hate it that much.
You can check if there is a pid for that find, and you will see it is running. \; just belongs to that find command at the end of the line.
The permission denied is a different issue, you need to find out why is it read only (no, it is not because of systemd).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.