#How to put static data in ram memory with a script?

1 messages · Page 1 of 1 (latest)

cold frost
#

I want to put some static data to ram memory. I have no idea how to start. Anyone who can help?

weak merlin
#

Write a C program and use malloc?

#

Be more specific, what's your goal: why do you want to store data in ram? What kind of data? Just any data or do you have something specific? What do you mean by a script? You can store something in memory when you make a variable in whatever language you want.

cold frost
#

ok so

#

so i need to make a service that puts some data in ram memory

weak merlin
#

Oh I see

cold frost
#

yeah i'm just new to this so yeah

#

hahaha

weak merlin
#

Well start by creating that dir

#

And that html file

cold frost
#

yeah i already did that

#

yeah i did that

mellow compass
#

it tells you what to do
then you just use /mnt/ramdisk or whichever other directory you choose as you would with any other directory
creating files and modifying them and that stuff

#

and it will stay in ram

cold frost
#

yeah the actually problem is that i don't know how to write that service

#

i mean

weak merlin
#

To run the service on startup you can use systemd: man systemctl

#

Just literally follow the instructions

cold frost
weak merlin
#

Well you dont need to create /mnt/ramdisk everytime but you do wanna mount it and copy the data from your "hard disk"

#

You should also google what a systemd wants out of a unit file

cold frost
#

ok thx i will do that

weak merlin
#

To see what cp works you can google it or check out the manual page in your shell: man cp

cold frost
#

yeah i know a little linux commands

#

and i know how to make a unit file

#

but yeah i'm just struggling with what i need to set in my .sh file

weak merlin
#

I think you just wanna run that mount command and then the cp the html file to the ramdisk

cold frost
#

yeah i already did that

weak merlin
#

systemctl enable servicename --now
Will enable it on boot and start the service without the need for reboot too

weak merlin
cold frost
#

ahh

weak merlin
#

Bc you wanna mount if everytime and then copy it bc ram is volatile