New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Comments
Shouldn't be hard to write your own, just a few lines of bash and put it in crontab.
Read /sys/class/net/eth0/statistics/tx_bytes
if $file > 1020054732800
shutdown
Don't have time to write it right now, but you got the idea, maybe someone else here can help you.
edit: Make sure you're running 64bit before doing this, else the statistics counter doesn't show up numbers larger than 2^32
Makenai what if the server reboots for whatever reason and he for example had already 945 GB used up? I bet you know what will happen, right? TX will nicely fall back to 0 and start counting again and so this little bash script is useless.
You need something that really monitors and saves the traffic state all the time.
Can't you ask your provider to put caps in place?
maybe find some script that read the solusvm bandwidth usage via solusvm API and monitor to choose if shutdown the VPS?
Why so complex
i'm just thinking how to get the accurate BW usage.
@AThomasHowe he using OneApp thingy and he told me it is not possible.
10$ for 1TB is not that expansive but it should not me.
What kind of traffic is using up the bandwidth, @Infinity580, and what kind of VPS is it? You could use IP tables traffic shaping if it's like, torrents using up all your b/w or HTTP or whatever. IP Tables would probably get a bit messy if your bandwidth is spread out over several ports, though.
KVM, just mix Torrent/Webserver etc.
to cron add this bash script.
If it's just two or three ports this server fault thread might be a good start then.
trickle nobody talks about that.
But that is great.
@neqste byte contains only cat /sys/class/net/eth0/statistics/tx_bytes so it dosent work.
Awesome. I didn't know about that file.
@Zen seems a bit buggy: /home/check: line 11: 4437091: command not found (if $byte > 1020054732800)
Well guys; you know, there's this wonderful system package called "vnstat" which can be used to create databases per network interface and actually log real traffic usage, both live and over time.
You can also plot the output, and use that to stem your madness.
+1. I use it on all my servers. It might not be 100% accurate, but it should work for what the OP wants to do especially since it is persistent across reboots.