Hello everyone,
I was just messing about with the following function and cannot figure
out why it won't work...
I know that the command I'm passing to the runtime object is a valid
unix command...i can execute it on my terminal no problem! Java however
refuses send the "halt" signal to my ubuntu shell...any ideas?
---------------------------------------------------------------------------------------------------------------------------------
(defn shutdown-pc [root-pwd minutes-after]
(let [op-system (System/getProperty "os.name")
enviroment (Runtime/getRuntime)]
(cond
(or (.startsWith op-system "Linux")
(.startsWith op-system "Mac OS"))
(.exec enviroment (str "echo " root-pwd " |" " sudo -S
shutdown -h +" minutes-after))
(.startsWith op-system "Windows")
(.exec enviroment (str "shutdown -s -t " minutes-after))
:else (throw (RuntimeException. "Unsupported operating system!"))))
----------------------------------------------------------------------------------------------------------------------------------
Thanks in advance...
Jim
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en