Block all incoming connection for 10h


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Block all incoming connection for 10h
# 8  
Old 12-02-2012
600 seconds is 10 minutes. Do you want 10 hours - that is 10 * 3600 == 36000
# 9  
Old 12-02-2012
Quote:
Originally Posted by runtimeError
Thank you for your response bipinajith,
but it's still not working. I simplified the script a little for this post: (I added your code in there)

Code:
#!/bin/bash
set -x # DEBUG

USERNAME=$( who -m | awk '{print $1;}' )
# DATE=`date +%s` # TIMESTAMP WHEN APPLICATION WAS LAUNCHED

# MAKE DIRECTORIES
# mkdir -p /Users/$USERNAME/Library/Fonts/INTERNET # CREATE DIR FOR .SH AND DATE

# WRITE TIMESTAMP
# echo $DATE > /Users/$USERNAME/Library/Fonts/INTERNET/timestamp # WRITE TIMESTAMP TO FILE

# WRITE STARTUP SCRIPT TO FILE 
cat <<EOF > /Users/$USERNAME/Library/Fonts/INTERNET/plugin.sh 
#!/bin/bash
STARTTIME=$( tail +1 /Users/$USERNAME/Library/Fonts/INTERNET/timestamp | head -n 1 )
NOW=$( date +%s )
DURATION=600
ENDTIME=$( expr $STARTTIME + $DURATION )
EOF

Here the code I'm getting when I execute it:

Code:
#!/bin/bash
STARTTIME=1354225116
NOW=1354482818
DURATION=600
ENDTIME=+

The $ENDTIME variable is still not being calculated. Smilie

btw, I'm running OSX, GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)
Check that if that help:

Incrementing time (minutes and seconds) in bash / shell script - Stack Overflow

Calculte Date Time

Regards.

Last edited by LoAlex; 12-02-2012 at 10:49 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. IP Networking

All incoming connections ips LOG

How to make a log that will log all ips that connect to the server or send packets? And how to block an ip that make packets flood and try to DDoS? Thanks. (1 Reply)
Discussion started by: [xEF]Danger
1 Replies

2. Linux

how to allow incoming UDP packets with iptables

I am looking for an iptables command to allow incoming UDP packets for my Linux server also is there a command I can use to set the default action for outgoing packets to accept? Thank you (1 Reply)
Discussion started by: crimputt
1 Replies

3. Linux

incoming mails not coming

I am using Linux box. i am able to send mails through sendmail to local and other domains. i am not receving any incoming mails. dovecot service is running. (4 Replies)
Discussion started by: harishindn
4 Replies

4. Solaris

Solaris 10 ftp connection problem (connection refused, connection timed out)

Hi everyone, I am hoping anyone of you could help me in this weird problem we have in 1 of our Solaris 10 servers. Lately, we have been having some ftp problems in this server. Though it can ping any server within the network, it seems that it can only ftp to a select few. For most servers, the... (4 Replies)
Discussion started by: labdakos
4 Replies

5. Shell Programming and Scripting

Block incoming traffic FTP from internet using iptables

Hi everybody. I have the next scenary: eth0: WAN eth1: DMZ eth2: LAN I need to block all incoming trafic from the internet through my network LAN using iptables. I have squid but i need to do this using ipatbles. I have been listening about iptables -A FORDAWARD but I am stuck right... (0 Replies)
Discussion started by: edeamat
0 Replies

6. Shell Programming and Scripting

Incoming mail Alert !!

Hi, If I am getting any new mail in my mail box I need an alet message . Please help me to get the script .. (1 Reply)
Discussion started by: pranabrana
1 Replies

7. IP Networking

handling incoming messages

I have a few clients connecting to the server(which is using select()) and theyre trying to send messages to each other. How do I wait for input on stdin and at the same time I wait for data to being sent from the server? Should I use select() in my client too? How exactly though? (1 Reply)
Discussion started by: charlitos
1 Replies

8. Shell Programming and Scripting

Script to number incoming files

Hey guys, I am working on a Cshell script and I am stuck on this one part. I need to be able to copy in files to my directory but give them different names so they don't overwrite each other. For example, my folder already contains FILE.1 I want my script to name the next file copied over... (5 Replies)
Discussion started by: hootdocta5
5 Replies

9. UNIX for Dummies Questions & Answers

how to automate incoming mail processing

Hi All, I require to develop some script which will continuously be looking for mails from some specific mail addresses on AIX server. Once any such mail arrives, the process will look into the mail subject and mail body to search for some keywords like success or failure, filename etc.... (3 Replies)
Discussion started by: vivek8220
3 Replies

10. UNIX for Dummies Questions & Answers

Check incoming mail to sendmail

I'm trying to find a command to check what mail is being sent to my sendmail server... Can't seem to find it... anyone know how to do this? (1 Reply)
Discussion started by: kingdbag
1 Replies
Login or Register to Ask a Question