Hi Matt,
You should run the cronjob in a separate process and the FileServer in another process.
mux := http.NewServeMux()
fs := http.FileServer(http.Dir("fileserver"))
mux.Handle("/", fs)
http.ListenAndServe(":8080", mux)
The FileServer package provided by the standard library will be
good(and small). In this way, you just separate the responsibility
between two processes.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- Warm Regards, Asit Dhal http://asit-dhal.github.io/
Hi,
Don't you think it will be over engineering.
Like Simon said, Apache can be used as a file transfer app(it has logging, loading, restarting).
Probably, his small app is an extension of some bigger go app.
His small app can use two different processes which runs under
two different user(you got system level isolation and North Korean
hackers are no more allowed to read unformulated files).
File server app usually never fails. Cron App usually fails, but
logs the error and works for the next cron job. Gocron doesn't
seem to have elegant error handling mechanism. The developer needs
to handle them somehow. Gocron will proudly fail if one
tasks fails to do error handling.
1. CronApp runs under "cron_user". On success, file permission changes to allow read to "Ftp_user".
2. Ftp_User simply sees a new file and displays them(delivers).
For a better file server, this one
https://github.com/codeskyblue/gohttpserver
As both of these processes have clearly different responsibility,
they don't need to be aware of each other.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.