Add imapsync calls and everything
This commit is contained in:
16
example.yaml
16
example.yaml
@ -1,15 +1,15 @@
|
||||
---
|
||||
- server1: mail.exampleserver1.de
|
||||
- host1: mail.examplehost1.de
|
||||
user1: exampleuser1
|
||||
pass1: examplepass1
|
||||
server2: mail.exampleserver2.de
|
||||
password1: examplepassword1
|
||||
host2: mail.examplehost2.de
|
||||
user2: exampleuser2
|
||||
pass2: examplepass2
|
||||
password2: examplepassword2
|
||||
|
||||
- server1: mail.exampleserver1.de
|
||||
- host1: mail.examplehost1.de
|
||||
user1: anotherexampleuser1
|
||||
pass1: anotherexamplepass1
|
||||
server2: mail.exampleserver2.de
|
||||
password1: anotherexamplepassword1
|
||||
host2: mail.examplehost2.de
|
||||
user2: anotherexampleuser2
|
||||
pass2: anotherexamplepass2
|
||||
password2: anotherexamplepassword2
|
||||
|
||||
|
||||
46
imapsync.nu
46
imapsync.nu
@ -1,8 +1,50 @@
|
||||
#!/bin/env nu
|
||||
|
||||
def main [conffile] {
|
||||
def main [] {
|
||||
print "Usage: imapsync.nu [show_data|test_creds|synchronize] example.yaml"
|
||||
}
|
||||
|
||||
open $conffile | each {|u| print $"server1: ($u.server1), user1: ($u.user1), \n server2: ($u.server2), user2: ($u.user2)" }
|
||||
def "main show_data" [conffile] {
|
||||
|
||||
(open $conffile |
|
||||
|
||||
each {|u|
|
||||
|
||||
print $"host1: ($u.host1), user1: ($u.user1),"
|
||||
print $"host2: ($u.host2), user2: ($u.user2)\n"
|
||||
}
|
||||
)
|
||||
""
|
||||
}
|
||||
|
||||
def "main test_creds" [conffile] {
|
||||
|
||||
(open $conffile |
|
||||
|
||||
each {|u|
|
||||
|
||||
print "Testing credentials for:"
|
||||
print $"host1: ($u.host1), user1: ($u.user1),"
|
||||
print $"host2: ($u.host2), user2: ($u.user2)\n"
|
||||
|
||||
imapsync --justlogin --host1 $u.host1 --user1 $u.user1 --password1 $u.password1 --host2 $u.host2 --user2 $u.user2 --password2 $u.password2 | print
|
||||
}
|
||||
)
|
||||
""
|
||||
}
|
||||
|
||||
def "main synchronize" [conffile] {
|
||||
|
||||
(open $conffile |
|
||||
|
||||
each {|u|
|
||||
|
||||
print "Synchronizing:"
|
||||
print $"host1: ($u.host1), user1: ($u.user1),"
|
||||
print $"host2: ($u.host2), user2: ($u.user2)\n"
|
||||
|
||||
imapsync --syncinternaldates --host1 $u.host1 --user1 $u.user1 --password1 $u.password1 --host2 $u.host2 --user2 $u.user2 --password2 $u.password2 | print
|
||||
}
|
||||
)
|
||||
""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user