generate html details file

  • I would like that in a specific folder x, which is a sub-folder of a shared folder, an html or other file could be automatically generated, in which there are the following information: file name and creation date of all the files contained in the folder x.

  • you dont need any html tags to serve a text via http. do a
    # ls -la /etc > test.html
    at your webroot and call it via browser...
    its not a nice one... but works.
    with >> you can catenate headers and footers but...
    if you want tables, colors, fontsize, css or whatever in html, you need a (parametric) parser like doxygen.
    You can use # ls -la /etc | sed ... too... if you are a feng shui master of regular Expressions.

    Equipment: a few Computers, lot's of waste heat, little time and a Pile of work.


    When solving problems, dig at the root instead of hacking at the leaves.

    Einmal editiert, zuletzt von Rd65 ()

  • ok a verry short and fast briefing to use a shell,cron,bashscripts... on pi:
    Use strg-alt-f1 strg-alt-f2 ans so on... to get a getty shell. use 3 keys together. most times on strg-alt-f6/7 you are back on X.
    the strg key may be signed als cntr or what ever ... strg is the german key layout. on pi and other nas:
    you can use most times ssh ... use putty on windows to login via ssh.
    or install omv-plugin shellinabox and do it via webpage.


    so try it on the shell: you will see.
    the ls command as example do the file-job and a execution via cron or anacron do it timed.
    to do this automatic, you can use plugin omv-anacron or use scheduled job (cron) to execute it on time. its a good start to learn about cron. on shell you can use pure cron/crontab or the cron-dirs in /etc/. edit text with #nano /textfile.txt
    try the forum search to find howtos about these plugins/tools and how they work.
    on shell, you can use #man cron and #man crontab to get more info. the web is full of hints. use q to leave man.
    you can edit a bash script like this on the footer.. without numbers...namend myscript.sh, put it in /etc/cron.hourly and your computer will remind you once per hour with a short beep-sound. maybe you need a speaker too... make it executable and the fun starts :) chmod a+x myscript.sh In this way you can do more shellscripts... but be carefull... you can easyly destroy things on shell. Use backups on your nas! If you hear the beep once per hour, you can exchange beep against ls and do text output to your wanted target dir at every time you want. Use this as a challenge to learn about cron...try to config cron to exactly beep on every 15 min beginning exactly at the hour like a real clock. cron wil do it timed or never, anacron wil remeber lost events (if a event ocure and your nas is off) and catch up the action. so beep with anacron is a bad idea... backup with anacron may be good. you can test the script by hand... use #./myscript.sh and remind the ./ at start. your script will not start without that ./
    if you are in panic, try #exit to close the shell. but its better not to panic....


    • #!/bin/bash
    • sleep 1
    • beep

    Equipment: a few Computers, lot's of waste heat, little time and a Pile of work.


    When solving problems, dig at the root instead of hacking at the leaves.

  • @Rd65 I would like to take advantage of this omv feature: https://imgur.com/E9Cmeb1
    in the "command" field can I also enter "myscript.sh"?


    ~update~
    @Rd65 I did some tests. if I send the output to a txt file and open it with notepad, the formatting of the list is not the same as the output of the command in the shell.
    so I would prefer an html output, it would be very nice, I just need a <br> tag after each line. I need to figure out how to do it with the SED command..


    ~update2~
    @Rd65 I found an interesting command:


    Bash
    tree -DthH "." > out.html

    I would like to run it for each folder inside the shared folders, so I would like to have an "out.html" for each folder.

  • i'm happy to see, that you are doing progress.
    yes you can try it in the command field.
    update 1:
    its difficult to use html output, as i told. its possible but its step 387... you are on step 2 or 3 on the learning curve.
    but dont give up...
    a way may be change all /lf chars (linefeed) against a <br> sed (streaming editor) can do that.
    update 2:
    yes tree is nice. there are lots of more possibilitys.
    "." is your startpoint "/" is the root of the tree.
    maybe take al look at
    tree -DthH "/srv/diskname/sharename/"
    In a shell you can use a tab key to list alternatives...
    #ls -la /srv/[tab] will show you diskname1, diskname2, ... its eayser no navigate and you dont need to remember all names.
    thumbs up!


    edit: ah no.. tree uses html output with -H. fine.
    i dont use tree but yes... maybe this help you to output html.
    maybe you can use a find command like this:
    #find /srv/diskname/sharename/ -type d | tree -DthH
    means... find al dirs starting at your shares and use tree on it.
    this can be done better... but for learning it is the next step

    Equipment: a few Computers, lot's of waste heat, little time and a Pile of work.


    When solving problems, dig at the root instead of hacking at the leaves.

    Einmal editiert, zuletzt von Rd65 ()

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!