The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
FreeBSD Support
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 java program from cron...
Author: db 
Date:   14-12-02 21:41

Hi,

Got a java program that calls ifconfig | grep like so:

Process p = Runtime.GetRuntime().exec(new String() {"sh", "-c", "ifconfig | grep '[-][-][>]'"});

Uses the output of grep to extract the new ip. This works fine when I execute the program from the shell. But when I add it to crontab, the exec call returns null.

Any ideas? Better ways?

Reply To This Message
 
 Re: java program from cron...
Author: Dan Langille 
Date:   16-12-02 01:00

Try putting a full path on each binary. e.g. /path/to/bin/ifconfig

Reply To This Message
 
 Re: java program from cron...
Author: db 
Date:   16-12-02 13:37

Thanks - that did the trick!

Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org