I’m trying to simulate a socket client using simple perl program.
socket client:
#!/usr/bin/perl
#path: /home/nuthan/client1
use IO::Socket;
my $sock = new IO::Socket::INET ( PeerAddr => 'xx.xx.xx.xx', PeerPort => '11050', Proto => 'tcp', );
die "Could not create socket: $!\n" unless $sock;
use POSIX 'strftime';
$time=strftime("%H%M%S",localtime) . "\n";
$date=strftime("%d%m%y",localtime)."\n";
$data="#00000##0#0000#AUT#1#V#07734.7000,E,1259.5355,N,000.00,288#$date#$time##";
print $data;
print $sock "$data";
close($sock);
command: bash script to execute
#!/bin/bash
#path: /bin/server
set PATH=/usr/bin/perl
export PATH
/home/nuthan/client1
#perl home/nuthan/client1
crontab command:
Run this socket client every 60 secs.
* * * * * server 2>&1 >> /var/log/client.log
Error: Finally, i get this Error!!!
No command 'bin' found, did you mean:
Command 'win' from package 'wily' (universe)
Command 'tin' from package 'tin' (universe)
Command 'bip' from package 'bip' (universe)
Command 'bing' from package 'bing' (universe)
Command 'bins' from package 'bins' (universe)
bin: command not found
WHERE AM I GOING WRONG!!!!? please help!!!
You should not set PATH to the perl executable but instead to the directories containing the tools you want to use, e.g.