You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have offlineimap setup to stay connected and sync when I run it. It would be really cool if I could get sup run it automatically as a background task. This way they will both only be running on the computer when I need to use sup.
The text was updated successfully, but these errors were encountered:
OK, so I have figured out how to get this working with a the following startup.rb hook
offlineimapDir=File.expand_path'~/.sup/offlineimap'ifDir.exist?offlineimapDirrequire'fileutils'FileUtils.rm_rofflineimapDirendDir.mkdirofflineimapDirsay"Running OfflineIMAP as background task."pid=spawn('offlineimap',err: "#{offlineimapDir}/error.log",out: "#{offlineimapDir}/out.log")Process.detachpidopen("#{offlineimapDir}/pid",'w')do |f|
f << pidend
However, when I attempt to clean stuff up as follows in shutdown.rb, it is never called...
idFile=File.expand_path'~/.sup/offlineimap/pid'ifFile.exist?pidFilebeginProcess.kill('SIGTERM',File.open(pidFile, &:readline).to_i)rescuesay"There was an issue ending the offlineimap background task."elsesay"Ended the offlineimap background task."endFile.deletepidFileelsesay"Houston, we have a problem! No pid file exists for the offlineimap background task."end
Your startup.rb and shutdown.rb hooks look fine to me. I also double-checked that sup executes those hooks correctly as documented. Are you sure your shutdown.rb is not getting called?
Bear in mind that say and debug and similar calls in the shutdown.rb hook will never be visible -- immediately after the shutdown hook runs, the log buffer is discarded and the curses display is reset. I found the only way to get a message out of shutdown.rb was to use STDERR.puts and run sup with stderr redirected to a file.
I have
offlineimap
setup to stay connected and sync when I run it. It would be really cool if I could getsup
run it automatically as a background task. This way they will both only be running on the computer when I need to usesup
.The text was updated successfully, but these errors were encountered: