mirror of
https://github.com/imapsync/imapsync.git
synced 2025-07-28 21:06:08 +02:00
2.140
This commit is contained in:
parent
4ce248c075
commit
f26b2573c3
370 changed files with 14441 additions and 136699 deletions
55
X/imapsync_shell_wrapper
Executable file
55
X/imapsync_shell_wrapper
Executable file
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh
|
||||
|
||||
# $Id: imapsync_shell_wrapper,v 1.6 2020/03/26 22:24:10 gilles Exp gilles $
|
||||
|
||||
## A pure working wrapper is like this one for example:
|
||||
## Uncomment the following lines to test it
|
||||
|
||||
#/usr/lib/cgi-bin/imapsync
|
||||
#date
|
||||
#id
|
||||
#cal
|
||||
#exit
|
||||
|
||||
## but the previous is a little useless and uneasy to add extra parameters
|
||||
## We need a little extra work.
|
||||
|
||||
|
||||
# Count characters in files, except the \r \n characters
|
||||
count_chars_but_nl()
|
||||
{
|
||||
cat "$@" | tr -d '\r\n' | wc -c
|
||||
}
|
||||
|
||||
# Run imapsync with parameters written in files given in arguments
|
||||
imapsync_with_extra_param()
|
||||
{
|
||||
# Update the environment variable CONTENT_LENGTH
|
||||
# This update is mandatory or the augmented parameters list will be truncated by imapsync.
|
||||
CONTENT_LENGTH=`count_chars_but_nl "$@"`
|
||||
cat "$@" | tr -d '\r\n' | /usr/lib/cgi-bin/imapsync
|
||||
}
|
||||
|
||||
# The actual stuff
|
||||
# Save the UI parameters in a file
|
||||
cat > /tmp/imapsync_shell_wrapper_from_ui.txt
|
||||
|
||||
# Now run imapsync with the UI parameters and the extra parameters
|
||||
imapsync_with_extra_param /tmp/imapsync_shell_wrapper_from_ui.txt /tmp/imapsync_shell_wrapper_extra.txt
|
||||
echo imapsync first run exited with return code $?
|
||||
echo
|
||||
who
|
||||
date
|
||||
|
||||
# A second run with other some extra_2 parameters
|
||||
imapsync_with_extra_param /tmp/imapsync_shell_wrapper_from_ui.txt /tmp/imapsync_shell_wrapper_extra_2.txt
|
||||
echo imapsync last run exited with return code $?
|
||||
echo
|
||||
cal
|
||||
echo
|
||||
echo Bye bye
|
||||
|
||||
# Got the picture?
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue