logotype
  • Home
  • Home
    • Homepage 1
    • Homepage 2
    • Homepage 3
    • Homepage 4
    • Homepage 5
    • Homepage 6
    • Homepage 7
    homepage 1

    Main home(01)

    homepage 2

    Creative agency(02)

    homepage 3

    Minimal agency(03)

    homepage 4

    Digital company(04)

    homepage 5

    Design company(05)

    homepage 6

    Minimal studio(06)

    homepage 7

    Portfolio minimal(07)

    homepage coming soon2

    In development(08)

  • About
  • Services
    • Website Design And Development
    • MOBILE APPS
    • MANAGEMENTS AND ASSIST
  • Blog
  • Contact
  • Pages
    • About us
    • Our team
    • Services
    • History
    • Philosophy
    • FAQ’s
    • Typography
    • Elements
    • Page 404
    • Coming soon
    • Mega menu page
  • Blog
    • Blog listing
    • Blog grid
      • 2 columns
      • 2 col + sidebar
      • 3 columns
      • 4 col wide
    • Masonry grid
      • 2 columns
      • 2 col + sidebar
      • 3 columns
      • 4 col wide
    • Blog singles
      • Standard
      • Video
      • Quote
      • Gallery
      • Link
      • Audio
    • Single layouts
      • Overlay image
      • Title first
      • Image first
  • Portfolio
    • Grid
      • 2 columns
      • 3 columns
      • 4 col wide
      • 5 col wide
    • Masonry
      • Grid 1
      • Grid 2
      • Grid 3
    • Gallery
    • Single
  • Shop
    • Cart
    • Checkout
    • My account
    • Wishlist
    Shop
    • Products Grid
    • Single Product
    • Cart
    • Checkout
    • Wishlist
    • Login - Register
    • Help Center
  • Contacts
    Contacts
    address:
    27 Division St, NY 10002 USA
    email:
    burido@mail.com
    phone:
    +1 800 123 456 78
    X-twitterFacebook-fInstagram
    Get in Touch

    Your email address will not be published. Required fields are marked *

Get in Touch
logotype
  • Home
  • Home
    • Homepage 1
    • Homepage 2
    • Homepage 3
    • Homepage 4
    • Homepage 5
    • Homepage 6
    • Homepage 7
    homepage 1

    Main home(01)

    homepage 2

    Creative agency(02)

    homepage 3

    Minimal agency(03)

    homepage 4

    Digital company(04)

    homepage 5

    Design company(05)

    homepage 6

    Minimal studio(06)

    homepage 7

    Portfolio minimal(07)

    homepage coming soon2

    In development(08)

  • About
  • Services
    • Website Design And Development
    • MOBILE APPS
    • MANAGEMENTS AND ASSIST
  • Blog
  • Contact
  • Pages
    • About us
    • Our team
    • Services
    • History
    • Philosophy
    • FAQ’s
    • Typography
    • Elements
    • Page 404
    • Coming soon
    • Mega menu page
  • Blog
    • Blog listing
    • Blog grid
      • 2 columns
      • 2 col + sidebar
      • 3 columns
      • 4 col wide
    • Masonry grid
      • 2 columns
      • 2 col + sidebar
      • 3 columns
      • 4 col wide
    • Blog singles
      • Standard
      • Video
      • Quote
      • Gallery
      • Link
      • Audio
    • Single layouts
      • Overlay image
      • Title first
      • Image first
  • Portfolio
    • Grid
      • 2 columns
      • 3 columns
      • 4 col wide
      • 5 col wide
    • Masonry
      • Grid 1
      • Grid 2
      • Grid 3
    • Gallery
    • Single
  • Shop
    • Cart
    • Checkout
    • My account
    • Wishlist
    Shop
    • Products Grid
    • Single Product
    • Cart
    • Checkout
    • Wishlist
    • Login - Register
    • Help Center
  • Contacts
    Contacts
    address:
    27 Division St, NY 10002 USA
    email:
    burido@mail.com
    phone:
    +1 800 123 456 78
    X-twitterFacebook-fInstagram
    Get in Touch

    Your email address will not be published. Required fields are marked *

Get in Touch
sessions Tag
HomePosts Tagged "sessions"

Tag: sessions

TokenBasedAuthentication
Blog
March 27, 2022By Amine G

How to Authenticate Users: JWT vs. Session

In web applications, you try to decide when to use either JSON Web Tokens (JWTs) or sessions (cookies) for authentication. When you browse the web you use HTTP, which is a stateless protocol. So, the only way to remember the states of your application is using either sessions or tokens.

Read More
Data Delete
Blog
August 27, 2019By Amine G

Efficiently delete a million files on Linux servers

Data Delete


It happens to the best: some script rockets to the skyline resulting in an instand system administrator headache because some folder – typically, sessions – was stuffed with millions of files. Linux is not quite happy with that, deleting the folder is not an option and the loyal “rm -rf” command decides to call it a day. To make things even worse: you want to remove only files of some days ago… what are the options?

Find is you friend

The Linux “find” command is a possible solution, many will go for:

find /yourmagicmap/* -type f -mtime +3 -exec rm -f {} \;

The command above will give a list of files older than 3 days and will pass each found file to the rm command. The rule above has one problem though: it will take some time, since calling the rm command a million times is not exactly what you can call efficient.

A better option is:

 find /yourmagicmap/* -type f -mtime +3 -delete

This adds the delete flag to the find command giving it the command to throw it all away. Do the right thing and pass along your command in a cronjob if you need to clean out the folder on a regular basis.

The rsync alternative!

rsync is without doubt one of the most handy commands when it comes to file operations. Rsync can do any kind of volume sync – as you may know – but it also provides a way to empty a folder.
The example below assumes you have a folder named /tmp/empty/ which contains no files, and a folder /tmp/session/ that contains too much crap. The rule below allows you to remove those files:

rsync -a --delete /tmp/empty /tmp/session/

Which is the fastest? 

rm: deleting millions of file is a no-can-do!

find -exec: an option, but slower!

find -delete: fast and easy way to remove loads of files.

rsync –delete: without doubt the quickest!

Read More