Hot answers tagged

5

I would use: if [[ "$my_path" != "$(realpath --canonicalize-existing $my_path)" ]];then echo The path $my_path is relative path or contains symlinks. else echo The path $my_path is absolute. fi


3

Two different approaches are possible: make a selection of the files that need transferring and feed that list to rsync and only those files will be copied. The find command is particularly useful for that. For example use find -ctime 1 -print0 /path/ | rsync --files-from - But other sources, filename patterns, a database query, input from the application ...


1

The command you call with sudo must match what is in the sudoers file, but in your case they do not match. You tried to run bash /usr/bin/iptables.sh, but sudoers only allows you to run /usr/bin/iptables.sh.


1

Finally found the solution. It is not an issue but due to the changes in the implementation of su command on Ubuntu-20.04. Here is the workaround: Edit the following file: sudo vi /usr/share/bash-completion/completions/su Replace line 44: COMPREPLY=( $(compgen -f -- $cur) ) with COMPREPLY=( $(compgen -u -- $cur) ) Source-1: https://stackoverflow.com/a/...


1

Each snapshot is a compete index of the data required to represent the file system at a point in time. Apart from the shared data space, the snapshots are totally independent of each other. You are thinking in terms of deltas, but zfs snapshots are not deltas. They don't contain any of the actual data so there's no benefit in doing it that way.


1

Use the system logger, which is available on every linux instance, docker container, mac os, etc etc. $ uname -a Darwin xxx xxxx Darwin Kernel Version xxx: Thu Jan 21 00:07:06 PST 2021; root:xxx/RELEASE_X86_64 x86_64 i386 xxx Darwin $ printf "%s\n" one two | logger -sp DEBUG Jul 4 00:51:42 christian[19358] <Debug>: one Jul 4 00:51:42 ...


1

Perl solution perl -mTime::HiRes -e 'printf "%.0f\n", (Time::HiRes::time() * 1000 )' Time::HiRes::time() returns a float of the form unixtimeinsec.microseconds Multiply by 1000 to shift left 3 digits, and output with no decimal digits. Why not just convert to integer with %d? Because it'll overflow a signed (or unsigned) integer on a 32 bit OS, ...


Only top voted, non community-wiki answers of a minimum length are eligible