LFTP fails on fast changing directories - ftp

LFTP 4.9.2 (Libraries used: Expat 2.2.6, Readline 7.0, zlib 1.2.11)
I'm trying to mirror a website with a fast changing cache directory. LFTP always fails with:
mirror: Access failed: 550 Can't change directory to cache-60cc55190313f589631026-tmp: No such file or directory (/web/wp-content/cache/comet-cache/cache-60cc55190313f589631026-tmp)
Already disabled cache, tried skip-noaccess. Nothing helps. Can someone advice?
lftp -u username,pass IP -p 21 -d -e 'set log:enabled yes;
set log:file "lftp.log";
set cache:enable no;
set cmd:verify-path-cached yes;
set mirror:parallel-directories no;
set ftp:ssl-allow no;
set ssl:verify-certificate no;
set ssl:check-hostname no;
set ftp:prefer-epsv false;
set ftp:list-options -a;
set net:timeout 15;
set net:max-retries 10;
set net:reconnect-interval-base 5;
set log:prefix-error "LFTP_ERROR";
set log:prefix-note "LFTP_NOTE";
set xfer:log 1;
set xfer:log-file "transfer.log";
set ftps:initial-prot "P";
set ftp:passive-mode true;
set -a;
mirror --skip-noaccess --parallel=7 /dir/ /download;
bye' 2>&1
There is nothing in global config file.

I had the same problem.
Simply exchange the two folders.
Before: mirror --skip-noaccess --parallel=7 /dir/ /download;
After:   mirror --skip-noaccess --parallel=7 /download /dir ;

Related

Bash: set name of directory as a variable while looping

I have a directory containing a big number of sub-directories within.
I need to loop over all subdiretories and save it names (without a path!) as a distinct variable
for d in ${output}/*/
do
dir_name=${d%*/}
echo ${dir_name}
done
the problem of the current version that it gives me a full path of the directory instead. Here is the result of echo
/Users/gleb/Desktop/DOcking/clusterizator/sub_folders_to_analyse/7000_CNE_lig992
/Users/gleb/Desktop/DOcking/clusterizator/sub_folders_to_analyse/7000_CNE_lig993
/Users/gleb/Desktop/DOcking/clusterizator/sub_folders_to_analyse/7000_CNE_lig994
/Users/gleb/Desktop/DOcking/clusterizator/sub_folders_to_analyse/7000_CNE_lig995
/Users/gleb/Desktop/DOcking/clusterizator/sub_folders_to_analyse/7000_CNE_lig996
/Users/gleb/Desktop/DOcking/clusterizator/sub_folders_to_analyse/7000_CNE_lig997
/Users/gleb/Desktop/DOcking/clusterizator/sub_folders_to_analyse/7000_CNE_lig998
/Users/gleb/Desktop/DOcking/clusterizator/sub_folders_to_analyse/7000_CNE_lig999
With the dir_name=${d%*/}, you remove the trailing / only. You will want to remove everything upto the last / as well. Or try basename, which is perhapse a better option.
As in:
for d in /var/*/ ; do
dir_name=${d%/}
base=$(basename "$d")
echo "$d $dir_name ${dir_name##*/} $base"
done
which produces:
/var/adm/ /var/adm adm adm
/var/cache/ /var/cache cache cache
/var/db/ /var/db db db
/var/empty/ /var/empty empty empty
/var/games/ /var/games games games
/var/heimdal/ /var/heimdal heimdal heimdal
/var/kerberos/ /var/kerberos kerberos kerberos
/var/lib/ /var/lib lib lib
/var/lock/ /var/lock lock lock
/var/log/ /var/log log log
/var/mail/ /var/mail mail mail
/var/man/ /var/man man man
/var/named/ /var/named named named
/var/netatalk/ /var/netatalk netatalk netatalk
/var/run/ /var/run run run
/var/slapt-get/ /var/slapt-get slapt-get slapt-get
/var/spool/ /var/spool spool spool
/var/state/ /var/state state state
/var/tmp/ /var/tmp tmp tmp
/var/www/ /var/www www www
/var/yp/ /var/yp yp yp
(on my system).
Can you cd to that parent directory?
cd ${output}/
lst=( */ )
for d in "${lst[#]}"; do echo "${d*/}"; done
If that's not an option, then you can strip it each time.
lst=( ${output}/*/ )
for d in "${lst[#]}"; do dir="${d*/}"; echo "${dir##/}"; done
As a hybrid, you can sometimes use a trick of changing directory inside a subshell, as the cd is local to the subshell and "goes away" when it ends, but so do any assignments.
cd /tmp
( cd ${output}/; lst=( */ ); for d in "${lst[#]}"; do echo "${d*/}"; done )
# in /tmp here, lst array does not exist any more...

Change standard separator comma for attachments

I know that comma will be used to separate files and other stuff with Blat mailer.
But I must send files with a comma in their filenames and have no possibility to change this circumstance.
Is there a way to change the standard separator?
Or any other way without changing the filename?
Here my example what I try to do:
set SERVER=127.0.0.1:2525
set USER=sendout#ralfbb-test.local
set PW=secret
set FROMNAME=sendout#ralfbb-test.local
set TO=nurmail1#ralfbb-test.local
set SUBJECT="Subject test - attached file!"
set BODY="Oh yes my dear lad!"
set BODYF="c:\Mailbody.txt"
set ATTACH="c:\517-BS24430-210416-NULL-0,750.pdf"
blat -server %SERVER% -f %FROMNAME% -u %USER% -pw %PW% -to %TO% -subject %SUBJECT% -bodyF %BODYF% -attach %ATTACH% -debug -log blat.log
Add a "" when calling the variable:
"%ATTACH%"

Asterisk GUI - Checking Write Permission for GUI Folder

I have installed Asterisk and Asterisk GUI on an Ubuntu Desktop 14.04. When I go to the GUI page and login it comes up and says "Checking write permission for gui folder" and stays on that screen.
http.conf file:
[general]
enabled = yes
bindaddr = 10.0.0.16
bindport = 8088
prefix = asterisk
;sessionlimit=100
enablestatic = yes
redirect = / /asterisk/static/config/index.htm
manager.conf file:
[general]
enabled = yes
webenabled = yes
port = 5038
bindaddr = 10.0.0.16
;#include "manager.d/*.conf"
[admin]
secret = admin
read = system,call,log,verbose,command,agent,user,config
write = system,call,log,verbose,command,agent,user,config,originate
Those config files have no any relation.
1) check in asterisk.conf which user it use(usualy asterisk)
2) do
chown asterisk /var/lib/asterisk/ /var/spool/asterisk -R
chmod 777 should only be required, when the user asterisk has not been added or when it's group membership is somehow messed up - otherwise a chown should be enough to open the astdb.sqlite3 in read/write mode.
chown -R asterisk:asterisk /etc/asterisk/ /var/lib/asterisk /usr/share/asterisk
chmod 644 /etc/asterisk/*
wiki

Is there any setting in the preseed file to ignore the Release 'Valid_Until' option?

I have just configured a preseed file to include a local repository.
# Debian mirrors
d-i apt-setup/local0/comment string local mirror
d-i apt-setup/local0/repository string http://<repo_url>
d-i apt-setup/local0/key string http://<repo_key>
The main issue I am facing here is that the repo is not added to the sources.list, as the Releases file expired some days ago, so I am not able to grab some packages I need.
I know there is this option which can be added to the apt.conf file:
Acquire::Check-Valid-Until "false"
which will ignore the fact that the Releases file expired some time ago. However, I really need a way to include this same option in the preseed file. For such purpose, I have been looking for possible solutions:
There is this german developer which seemed to be suffered from the same (https://lists.debian.org/debian-user-german/2012/04/msg00382.html). Basically, he is suggested to try adding:
d-i apt-setup/check_valid_until boolean false
but I have tried that option, and it was not successful.
I thought about including something in the late_command stage to update the sources.list accordingly (i.e. executing
in-target echo <my_mirror_information> >> /etc/apt/sources.list.d/custom.list
in-target apt-get -o Acquire::Check-Valid-Until="false" update
in-target apt-get upgrade
However, I do believe this is not the proper way of solving the issue, since there is an apt-setup section prepared to deal with these issues.
Is there any other solution which I can use in the preseed?
Thank you very much!
This works:
d-i partman/early_command string echo "echo 'Acquire::Check-Valid-Until \"false\";' > /target/etc/apt/apt.conf.d/02IgnoreValidUntil" > /usr/lib/apt-setup/generators/02IgnoreValidUntil ; chmod +x /usr/lib/apt-setup/generators/02IgnoreValidUntil
Having the same problem and not finding a solution either I finally got it working using preseed with:
d-i partman/early_command string echo "echo 'Acquire::Check-Valid-Until \"false\";' > /target/etc/apt/apt.conf.d/02IgnoreValidUntil" > /usr/lib/apt-setup/generators/02IgnoreValidUntil ; chmod +x /target/etc/apt/apt.conf.d/02IgnoreValidUntil
This is for Debian/Jessie
d-i preseed/run string script.sh
inside "script.sh":
fix_apt_repo_expire()
{
local APT_DIR="/target/etc/apt/apt.conf.d"
while [ ! -d "$APT_DIR" ]; do sleep 1; done
echo 'Acquire::Check-Valid-Until "false";' > "$APT_DIR"/90ignore-repo-expiry
}
fix_apt_repo_expire &

Vim automatically disable scan in included files for autocompletion when on networked filesystem

The following bash script checks whenever current pwd is mounted by sshfs:
if (! mountpoint -q $PWD ); then
# not mounted
else
# mounted
fi
I would like to Vim to do the same on current newly opened buffer and if the current directory is networked filesystem (means it is mounted) then Vim should execute set complete-=i command. Only in current split if possible.
To check whether the current buffer's directory is mounted:
:call system('mountpoint -q ' . shellescape(expand('%:h')))
:let isMountpoint = (v:shell_error == 0)
To hook this into buffer reads, invoke this through :autocmd BufRead * ...
The 'complete' option is indeed buffer-local, so with :setlocal complete-=i, you can achieve that, too.
Now, you just need to combine the pieces:
:autocmd BufRead * call system('mountpoint -q ' . shellescape(expand('%:h'))) | if v:shell_error == 0 | setlocal complete-=i | endif

Resources