Set Static IP address,hardware /system clock

Started by cKon, September 15, 2013, 02:56:53 PM

Previous topic - Next topic

cKon

Hi,
   Is there a way to enable/disable DHCP and set static ip address through a program(ansi-c),also ways to set the hwclock and sysclock. Currently , i do it from command-line , but dont want to ssh everytime to change it ,would be convenient to include the code in the application.

Thanks in advance.

Regards,
cKon

Christian Jann

Yes there are configuration files to enable/disable DHCP and set static ip address  (https://wiki.archlinux.org/index.php/Network_Configuration) and also to to set the hardware clock (https://wiki.archlinux.org/index.php/Time, https://wiki.archlinux.org/index.php/Network_Time_Protocol_daemon).

If you're currently doing it from the command line then you can also put the commands into a startup script (https://wiki.archlinux.org/index.php/Initscripts).

If you want to do it through your ansi-c program then you can either look into the source code of the commands that that you are currently using to set the time etc. or simply call them from your program (https://www.linuxquestions.org/questions/programming-9/execute-shell-command-inside-of-c-code-188645/).

cKon

Hi Christian,
             Thank you , was wondering ,whether this sort of a question was to be posted here or in archlinuxarm forum.Thanks for your response,will check soon.

Regards,

cKon